Open garth-waters opened 10 months ago
HI. Garth,
Whenever the tree is updated, using any state management tool like GetIt, the didUpdateTree. All the update in the tree, including node add, insert, remove and modify are calculated, and the changes are applied to the old tree.
Simply replacing the tree root will not work, library uses the AnimatedListView
which keeps are permanent reference to the lists, and all the changes need to be applied the list being reference by AnimatedListView
.
I would advise that first make sure that your tree changes are being properly applied by looking into whether the didUpdateTree
method is being called, and the diffs are being properly calculated.
After that, please debug whether your State Management tool, is actually updating the widget tree or not when you are modifying the three
for reference you can check out the nodes_data_update_sample.dart
Hi,
Thanks very much for this package. I seem to have an issue when I change the root node and rebuild the treeview widget. The treeview builds the same but when the build method is called it seems to remember the old root nodes. The build method is called with nodes that no longer exist in the new root node. As an example if I create a root node with 3 nodes the build method is correctly called 3 times. Then if I change the root node to just 1 node and rebuild then the builder is called 4 times. This is the root node output - IndexedNode{children: [IndexedNode{children: [], key: 1, parent: IndexedNode{children: [...], key: /, parent: null}}], key: /, parent: null}
I am using the GetIt mixin with a stateless widget to create the TreeView.
Many Thanks Garth