Open ashik-jyothi opened 3 years ago
I tried to reproduce the issue, but it seems working fine in this sandbox.
I think you probably only update initialOpenNodes
without updating data
(i.e. commenting out line 77-91 in the sandbox example). Then, indeed initialOpenNodes
is only updated when data
is also updated.
I am trying to keep the first node to be open when my component renders but the data is still not available at the point (initialOpenNodes={['']}) as it is fetched via API. Once the data is fetched, TreeMenu renders again with the required data (initialOpenNodes={['<node_name'>']}) but it is not taking the updated prop. I tested this by hardcoding the value and it works fine. So, I assume that the value set on first render is what TreeMenu consumes ignoring the subsequent renders. Even tried with
resetOpenNodesOnDataUpdate
prop set totrue
.Can you please look into this?