Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue reactivity breaks custom array implementations (proxy on arrays, classes extending Array, array-like classes) #2314

Closed
neryams opened this issue Oct 6, 2020 · 1 comment · Fixed by #3624

Comments

@neryams
Copy link

@neryams neryams commented Oct 6, 2020

Version

3.0.0

Reproduction link

https://codepen.io/rohmori/pen/zYBOeyv?editors=1010

Steps to reproduce

Click "Say hello". Note that the alert says "hello world" (the "world" string is coming from the array proxy). Also note that the page header changes to "Proxy works!".

Now click "Say hello wrapped by vue ref". Note that the proxy array is being bypassed so the code does not run and the "world" is not returned from the pop function.

What is expected?

The vue ref should pass calls on array functions through to the underlying array

What is actually happening?

The vue ref bypasses the underlying array and calls the functions on the Array.prototype instead.


We use proxies extensively in our project and expect vue to pass calls and property accesses through to the underlying objects in all cases

@neryams
Copy link
Author

@neryams neryams commented Oct 6, 2020

I created this PR, which fixes the issue in my local project #2315

@neryams neryams changed the title Vue reactivity breaks custom array implementations (proxie on arrays, classes extending Array, array-like classes) Vue reactivity breaks custom array implementations (proxy on arrays, classes extending Array, array-like classes) Oct 6, 2020
yyx990803 pushed a commit that referenced this issue Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants