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

fix(reactivity): enable trigger when use str to set length of arr #6810

Merged
merged 2 commits into from Oct 21, 2022

Conversation

bcq028
Copy link
Contributor

@bcq028 bcq028 commented Oct 3, 2022

js allows use string to set length of array.
The original code uses an implicit conversion that requires newValue to be a number as key's type is string. If newValue is also a string, string comparison are performed instead of number comparison. The string comparison is lexicographical order, so "10"< "2", causing the length to be set to 2 but watch element at 10 will not be triggered

@antfu
Copy link
Member

antfu commented Oct 3, 2022

That's a strange behavior of JS, TIL. 😅

@antfu antfu added the ready to merge The PR is ready to be merged. label Oct 3, 2022
@netlify
Copy link

netlify bot commented Oct 4, 2022

A new user left a comment. This user must be approved by a Netlify team owner before comments can be displayed.

Approve this user

@LinusBorg LinusBorg merged commit e6224f4 into vuejs:main Oct 21, 2022
chrislone pushed a commit to chrislone/core that referenced this pull request Feb 4, 2023
zhangzhonghe pushed a commit to zhangzhonghe/core that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge The PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants