-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customized tree view - Material UI issue #24369
Comments
It re-renders the endIcon component again and you lose your state if you open it again it set to the initial value. You need to save that state to your treeNode with checked attribute yourself it's not a bug. |
Re-rendering entire tree on expand and collapse is not a optimised approach. |
Your Icon is re-rendering all the time, not the tree. The tree has its own state which branch is open from the beginning even it is not rendered. Take a look at what happens when you collapse a tree item, the result is no DOM element found in HTML so where did the state go? It's stored in the root of the tree which is persisting on the top level. Going back to your problem why you think it should store your Icon state if it renders all the time on open and close? |
I think collapsing accordion should only hide its inner content and show during expansion. But any of its inner content should not re-render. There is a fault in the accordion implementation. According to me, |
👋 Thanks for using Material-UI! We use GitHub issues exclusively as a bug and feature requests tracker, however, For support, please check out https://material-ui.com/getting-started/support/. Thanks! If you have a question on StackOverflow, you are welcome to link to it here, it might help others. |
@oliviertassinari, there's a bug in tree view accordion which is implemented by material ui team and not by me. You will understand if you read my comments carefully. |
Kindly reopen it. |
@povilass, thanks a lot!!! |
I have created a tree using "Customized tree view - material UI". However, I'm facing a challenge:
defaultEndIcon state is getting lost on accordion collapse and then expand:
Selected defaultEndIcon:
Accordion collapsed and then expanded again:
defaultEndIcon sate is lost
PFB codesandbox url:
https://codesandbox.io/s/material-demo-forked-9ovph?file=/demo.tsx
PFA codesandbox screen recording for reproducing the issue.
Screen.Recording.2021-01-11.at.4.17.07.PM.mov
The text was updated successfully, but these errors were encountered: