react-checkbox-tree
react-checkbox-tree copied to clipboard
Changing node.disabled not shown when re-rendering
Describe the bug Some node properties aren't reflected on re-render when changed programmatically.
I'm attempting to use react-checkbox-tree to show map layers. It's common to define when some spatial layer can be drawn based on the map scale (show only at neighborhood scale, not world scale). I'd like to disable nodes when the corresponding layer is out of scale, but my tree isn't reflecting this change of state. I can change the node's icon
or label
, I can't changed disabled
or showCheckbox
.
Interestingly, if I programmatically add a new node the tree looks to redraw completely. This initially made me worry that I was doing something wrong, but the simple example below shows this fairly clearly.
Reproduction steps https://codesandbox.io/s/react-checkbox-tree-example-forked-dx5sh?file=/src/components/Widget.js
Expected behavior I expect that when nodes change and the widget is re-rendered that these changes are reflected on screen.
Thanks for the test case.