Skip to content

Commit 7d41f1b

Browse files
authored
Merge pull request #47 from ptoussai/fix-subtreeCallback-example
Fix `recomputeTree` example in README.md
2 parents e416401 + e21b54e commit 7d41f1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ The rules object has the following shape:
245245
- `open: boolean` - this rule changes the openness state for the owner node only (subtree nodes are not affected).
246246
- `subtreeCallback(node: object, ownerNode: object): void` - this callback runs against each node in the subtree of the owner node (including the owner node as well). It receives the subtree node and the owner node. Changing any property of the subtree node will affect the node state and how it will be displayed (e.g. if you change the node openness state it will be displayed according to the changed state).
247247

248-
The order of rules matters. If you specify the child node rules before the parent node rules, and that rules affect the same property, the parent node `subtreeWalker` will override that property. So if you want to override parent's rules, place children rules after the parent's.
248+
The order of rules matters. If you specify the child node rules before the parent node rules, and that rules affect the same property, the parent node `subtreeCallback` will override that property. So if you want to override parent's rules, place children rules after the parent's.
249249

250250
The type of the node objects received by `subtreeCallback` is `FixedSizeNodePublicState`. See the [types description](#types) below.
251251

@@ -278,8 +278,8 @@ const tree = {
278278
tree.recomputeTree({
279279
'root-1': {
280280
open: false,
281-
subtreeWalker(node, ownerNode) {
282-
// Since subtreeWalker affects the ownerNode as well, we can check if the
281+
subtreeCallback(node, ownerNode) {
282+
// Since subtreeCallback affects the ownerNode as well, we can check if the
283283
// nodes are the same, and run the action only if they aren't
284284
if (node !== ownerNode) {
285285
// All nodes of the tree will be closed
@@ -659,4 +659,4 @@ const Node = ({data: {isLeaf, name}, isOpen, style, setOpen}) => (
659659

660660
### 5. Migrate all your IDs to string
661661

662-
Using node IDs as keys should improve React rendering performance. However, it means that you won't be able to use `Symbol` as IDs anymore. You should move all your IDs to be strings instead of symbols.
662+
Using node IDs as keys should improve React rendering performance. However, it means that you won't be able to use `Symbol` as IDs anymore. You should move all your IDs to be strings instead of symbols.

0 commit comments

Comments
 (0)