-
Notifications
You must be signed in to change notification settings - Fork 27
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
Re-assigned array items gets transformed to proxies #44
Labels
kind/bug
Categorizes issue or PR as related to a bug.
Comments
Short DescriptionAdding or removing items to an array using push and pop will keep the original items as there are. While adding or removing using shift and unshift which will move items to different indexes will also "unexpectedly" transform those items to proxies. |
pmdartus
added
kind/bug
Categorizes issue or PR as related to a bug.
and removed
bug
labels
May 25, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When using array methods that re-assign indexes like (splice, shift, unshift, sort, reverse), According to the way they work e.g. unshift, The method will get() re-assigned items though the membrane which will return proxy whenever the item is observable.
As a result, the method will replace the original target items with proxies, which will contaminate the original target with proxies instead of values.
Steps to Reproduce
Expected Results
on 3rd loop, the
===
should yield false becausep
is a proxy ofo
Actual Results
on 3rd loop, the
===
yields true for re-assigned items with new index 1 and 2 because the re-assigned items are now proxies in the original target.Possible Solution
Will create a PR to fix this by checking if re-assigning observable value to array, Then unwrap the value to revert the unwanted get() proxy wrapping.
The text was updated successfully, but these errors were encountered: