Skip to content

Conversation

@drborges
Copy link
Owner

  • Prevent re-renders on unmounted React components still bound to detached nodes of the store. This is mostly in React versions where useSyncExternalStore is not available and @arborjs/react resorts to useState for updates;

…t detached

This is important to avoid updates in unmounted React components still bound to detached nodes of the store
@codesandbox
Copy link

codesandbox bot commented Feb 21, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

}

return path.seeds.some(
(seed) => !node.$tree.getLinkFor(seed) && !node.$tree.getNodeFor<Node>(seed)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures a node is detached if:

  1. itself is detached;
  2. or any of its ancestors are detached (since the state is a Tree).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants