-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor that get notified if object/collection has changed, not its nested elements #451
Comments
This is as expected since the tree is immutable, meaning an update to a child will also yield a new Object reference for the parent but the child that wasn't modified is re-referenced in the new parent under the same address. |
I've had similar problems that I solved letting the child components be In example https://github.com/Yomguithereal/baobab#events it says that both My use case is: I have a component that is bound to collection or object If parent component gets render notification, then it causes whole tree to Here is a snippet from README with the example: var tree = new Baobab({ // And the following cursors — |
In example https://github.com/Yomguithereal/baobab#events it says that both
'users'
and['users', 'john']
cursors will be notified if John's firstname is changed. Is there a way to notify['users', 'john']
only and not'users'
? Same for collections, if I have a list of users, how can I bind to change of list (item added, item removed, list replaced), not its nested elements?My use case is: I have a component that is bound to collection or object (that represents tree as nested ojbects), I want parent component to get re-rendered (notified of change) only when collection or object changes number of items/keys or gets replaced, not when children props values are changed, as I am going to have each child as a component bound directly to corresponding item in the tree.
If parent component gets render notification, then it causes whole tree to be re-rendered, which is very slow as it has quite a few elements.
Here is a snippet from README with the example:
The text was updated successfully, but these errors were encountered: