core
core copied to clipboard
fix(reactivity): enable trigger when use str to set length of arr
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
That's a strange behavior of JS, TIL. 😅
A new user left a comment. This user must be approved by a Netlify team owner before comments can be displayed.