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
feat: pass the node to postProcess snapshot transformers (#2116)
When transforming the snapshot for a node, it would be quite handy to get access to the node the snapshot was generated for, so you can traverse the tree to get at data you want to put in the snapshot. Stored properties of that node are already given to you in the hook in the snapshot, but computeds, data from parents, tree environment data, or volatiles aren't accessible for use in snapshot transformers unless the node is passed in.
Woop woop!
Copy file name to clipboardexpand all lines: docs/concepts/snapshots.md
+2
Original file line number
Diff line number
Diff line change
@@ -56,3 +56,5 @@ Useful methods:
56
56
-`getSnapshot(model, applyPostProcess)`: returns a snapshot representing the current state of the model
57
57
-`onSnapshot(model, callback)`: creates a listener that fires whenever a new snapshot is available (but only one per MobX transaction).
58
58
-`applySnapshot(model, snapshot)`: updates the state of the model and all its descendants to the state represented by the snapshot
59
+
60
+
`mobx-state-tree` also supports customizing snapshots when they are generated or when they are applied with [`types.snapshotProcessor`](/overview/hooks).
0 commit comments