You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Demo: http://jsfiddle.net/simplesmiler/nmsc5cry/4/
Explanation: Inside a component with a two-way synced array prop items, if items is assigned after items.push or any other method, then the assignment gets ignored.
Foreseeing the question "why mutate before assign", there are use cases. For example:
this.items=this.items.splice(start,length);// keep only elements from `start` to `start+length`
EDIT: Actually use case above can be solved without mutation, using slice instead of splice.
Credits to @Kerruba for raising the issue in chat.
The text was updated successfully, but these errors were encountered:
Demo: http://jsfiddle.net/simplesmiler/nmsc5cry/4/
Explanation: Inside a component with a two-way synced array prop
items
, ifitems
is assigned afteritems.push
or any other method, then the assignment gets ignored.Foreseeing the question "why mutate before assign", there are use cases. For example:
EDIT: Actually use case above can be solved without mutation, using
slice
instead ofsplice
.Credits to @Kerruba for raising the issue in chat.
The text was updated successfully, but these errors were encountered: