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
Copy file name to clipboardExpand all lines: README.md
+2
Original file line number
Diff line number
Diff line change
@@ -1019,6 +1019,7 @@ See the [full API docs](API.md) for more details.
1019
1019
|[`isAlive(node)`](API.md#isalive)| Returns `true` if `node` is alive |
1020
1020
|[`isStateTreeNode(value)`](API.md#isstatetreenode)| Returns `true` if `value` is a node of a mobx-state-tree |
1021
1021
|[`isProtected(value)`](API.md#isprotected)| Returns `true` if the given node is protected, see [actions](#actions)|
1022
+
|[`isValidReference(() => node | null | undefined, checkIfAlive = true)`](API.md#isvalidreference)| Tests if a reference is valid (pointing to an existing node and optionally if alive) and returns if the check passes or not. |
1022
1023
|[`isRoot(node)`](API.md#isroot)| Returns true if `node` has no parents |
1023
1024
|[`joinJsonPath(parts)`](API.md#joinjsonpath)| Joins and escapes the given path `parts` into a JSON path |
1024
1025
|[`onAction(node, (actionDescription) => void)`](API.md#onaction)| A built-in middleware that calls the provided callback with an action description upon each invocation. Returns disposer |
@@ -1037,6 +1038,7 @@ See the [full API docs](API.md) for more details.
1037
1038
|[`splitJsonPath(path)`](API.md#splitjsonpath)| Splits and unescapes the given JSON `path` into path parts |
1038
1039
|[`typecheck(type, value)`](API.md#typecheck)| Typechecks a value against a type. Throws on errors. Use this if you need typechecks even in a production build. |
1039
1040
|[`tryResolve(node, path)`](API.md#tryresolve)| Like `resolve`, but just returns `null` if resolving fails at any point in the path |
1041
+
|[`tryReference(() => node | null | undefined, checkIfAlive = true)`](API.md#tryreference)| Tests if a reference is valid (pointing to an existing node and optionally if alive) and returns such reference if it the check passes, else it returns undefined. |
1040
1042
|[`unprotect(node)`](API.md#unprotect)| Unprotects `node`, making it possible to directly modify any value in the subtree, without actions |
1041
1043
|[`walk(startNode, (node) => void)`](API.md#walk)| Performs a depth-first walk through a tree |
1042
1044
|[`escapeJsonPath(path)`](API.md#escapejsonpath)| escape special characters in an identifier, according to http://tools.ietf.org/html/rfc6901|
Copy file name to clipboardExpand all lines: changelog.md
+2
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
- Added `tryReference` and `isValidReference` to use references that might be no longer pointing to any nodes in a safe way through [#1087](https://github.com/mobxjs/mobx-state-tree/pull/1087) by [@xaviergonz](https://github.com/xaviergonz)
2
+
1
3
# 3.8.1
2
4
3
5
- Fixed non-initialized nodes not being destroyed [#1080](https://github.com/mobxjs/mobx-state-tree/issues/1080) through [#1082](https://github.com/mobxjs/mobx-state-tree/pull/1082) by [@k-g-a](https://github.com/k-g-a)
0 commit comments