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
Because Arbor nodes are proxies around data and even though for instances of Arbor, the underlying data is mutable the proxies wrapping nodes in the OST (observable state tree) get "refreshed" every time the underlying data is mutated. This is done so that we can easily compute diffs on the OST, by simply comparing the identity of nodes, e.g. ===.
However, this behavior can create some unexpected behavior. For instance, take the following store holding an array of todos:
Then the identity of the variable todo1 will no longer be the same as store.state[0] since that node in the OST will be refreshed to indicate it has been mutated, so the following will be false:
todo1===store.state[0]=>false
Providing a utility function to allow users to compare nodes by their seeds can provide a similar behavior as the identity check mentioned above:
Because Arbor nodes are proxies around data and even though for instances of
Arbor
, the underlying data is mutable the proxies wrapping nodes in the OST (observable state tree) get "refreshed" every time the underlying data is mutated. This is done so that we can easily compute diffs on the OST, by simply comparing the identity of nodes, e.g.===
.However, this behavior can create some unexpected behavior. For instance, take the following store holding an array of todos:
Should we get a reference of say,
todo 1
and mutate it like so:Then the identity of the variable
todo1
will no longer be the same asstore.state[0]
since that node in the OST will be refreshed to indicate it has been mutated, so the following will be false:Providing a utility function to allow users to compare nodes by their seeds can provide a similar behavior as the identity check mentioned above:
Prototype
The text was updated successfully, but these errors were encountered: