Skip to content

Commit cf13470

Browse files
docs(proxy-state-tree): update docs
1 parent 33d4b04 commit cf13470

File tree

1 file changed

+3
-3
lines changed
  • packages/node_modules/proxy-state-tree

1 file changed

+3
-3
lines changed

packages/node_modules/proxy-state-tree/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const paths = tree.clearPathsTracking(trackId)
4949
console.log(paths) // Set { 'foo', 'bar' }
5050
```
5151

52-
You would typically use this mechanism to track usage of state. For example rendering a component, calculating a a computed value etc. The returned paths array is stored for later usage. The paths structure is used internally by proxy-state-tree, but you can also consume it as a library author to for example showing components and what paths they depend on in a devtool. Nested paths uses dot notation, for example `['foo.bar']`. Path tracking can be nested, but they can not run at the same time. Meaning the nested tracking must finish before the outer tracker.
52+
You would typically use this mechanism to track usage of state. For example rendering a component, calculating a a computed value etc. The returned paths set is stored for later usage. The paths structure is used internally by proxy-state-tree, but you can also consume it as a library author to for example showing components and what paths they depend on in a devtool. Nested paths uses dot notation, for example `['foo.bar']`. Path tracking needs to be synchronous from the beginning of the tracking, but the clearing of tracking can be asynchronous.
5353

5454
## Track mutations
5555

@@ -102,7 +102,7 @@ function render () {
102102
return tree.clearPathsTracking(trackId)
103103
}
104104

105-
const listener = tree.addMutationListener(render(), () => {
105+
const listener = tree.addMutationListener(render(), (flushId) => {
106106
// Runs when mutations matches paths passed in
107107

108108
// Whenever mutations affecting these paths occurs
@@ -137,7 +137,7 @@ const tree = new ProxyStateTree({
137137
})
138138
const state = tree.get()
139139

140-
const listener = tree.addMutationListener((mutations) => {
140+
const listener = tree.addMutationListener((mutations, flushId) => {
141141
/*
142142
[{
143143
method: "set",

0 commit comments

Comments
 (0)