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
Labels
has PR A pull request has already been submitted to solve the issue need test The PR has missing test cases. scope: reactivity

Comments

@neryams
Copy link

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 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 yyx990803 added the need test The PR has missing test cases. label Oct 13, 2020
@HcySunYang HcySunYang added the has PR A pull request has already been submitted to solve the issue label Mar 12, 2021
yyx990803 pushed a commit that referenced this issue Jul 15, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has PR A pull request has already been submitted to solve the issue need test The PR has missing test cases. scope: reactivity
Projects
None yet
4 participants