Skip to content
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

[collapsible] SupportkeepMounted prop #728

Closed
mj12albert opened this issue Oct 9, 2024 · 4 comments · Fixed by #889
Closed

[collapsible] SupportkeepMounted prop #728

mj12albert opened this issue Oct 9, 2024 · 4 comments · Fixed by #889
Assignees
Labels
component: accordion This is the name of the generic UI component, not the React module! component: collapsible This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@mj12albert
Copy link
Member

mj12albert commented Oct 9, 2024

Follow up to #577 (review)

Do we have an API to not mount the children of an accordion? Something similar to https://mui.com/material-ui/react-accordion/#performance. When rendering heavy components under an accordion, e.g. in a dashboard: charts, data grid, etc. It can be a lifesaver for the performance responsiveness on the page.

Or is the idea to solve this problem with a new component of this kind: https://ark-ui.com/react/docs/utilities/presence?

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 9, 2024
@mj12albert mj12albert self-assigned this Oct 9, 2024
@mj12albert mj12albert added new feature New feature or request component: collapsible This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 9, 2024
@colmtuite
Copy link
Contributor

This seems back-to-front to me. Wouldn't it be better—and more in-line with our other components—if the panel contents unmounted by default, and then you can use the keepMounted prop if you need it?

cc @michaldudak

@michaldudak
Copy link
Member

I'd name the prop keepMounted for sure. As for its default value, I don't have a strong opinion, but I lean towards making it consistent with other components (so false).

@mj12albert mj12albert changed the title [collapsible] Add unmountOnExit prop [collapsible] SupportedkeepMounted prop Nov 1, 2024
@mj12albert
Copy link
Member Author

@colmtuite I agree with naming this as keepMounted instead

I think it makes sense for the default for this to be true, because generally browsers implement the behavior of the hidden attribute with CSS display: none, which doesn't remove the Panel (and contents) from the DOM

And for other components, keepMounted is needed for animations using Framer; while for Collapsible, it would be for performance, e.g. if you have a lot of Collapsibles with heavy components in the Panel as @oliviertassinari mentioned, what do you think?

@mj12albert mj12albert changed the title [collapsible] SupportedkeepMounted prop [collapsible] SupportkeepMounted prop Nov 6, 2024
@mj12albert mj12albert added the component: accordion This is the name of the generic UI component, not the React module! label Nov 29, 2024
Copy link

github-actions bot commented Dec 3, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: accordion This is the name of the generic UI component, not the React module! component: collapsible This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
3 participants