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
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In the documentation here: https://mobx-state-tree.js.org/tips/more-tips#tojson-for-debugging, it describes
.toJSON()
andgetSnapshot
as equivalent, but it appears as this is only true for models?For example, for observable arrays, calling
.toJSON()
on an observable array, only converts it shallowly, but for models, this is not the case.Here is an example (it is better to see the logs in the actual browser console so you can see which are plain objects and which are still MST nodes):
https://codesandbox.io/s/todo-store-forked-4svfg?file=/src/index.js
Beta Was this translation helpful? Give feedback.
All reactions