react-checkbox-tree icon indicating copy to clipboard operation
react-checkbox-tree copied to clipboard

Changing node.disabled not shown when re-rendering

Open jhevenor opened this issue 4 years ago • 1 comments

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.

jhevenor avatar Nov 12 '20 15:11 jhevenor

Thanks for the test case.

jakezatecky avatar Nov 12 '20 18:11 jakezatecky