iannbing / iannbing/react-simple-tree-menu

initialOpenNodes is not updated on re-render of the component

Open
#174 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
138
Forks
44
PR merge metrics
No merged PRs in 30d

Description

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={['']}) 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 to `true`.

Can you please look into this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.