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

Add Optional destroyOnClose Property to Drawer Component #53

Open
swttpch opened this issue Nov 27, 2024 · 0 comments
Open

Add Optional destroyOnClose Property to Drawer Component #53

swttpch opened this issue Nov 27, 2024 · 0 comments

Comments

@swttpch
Copy link

swttpch commented Nov 27, 2024

Hello, and thank you for the great work on this library!

I’d like to suggest adding an optional destroyOnClose property to the Drawer component. This would help in scenarios where resources associated with the Drawer need to be cleaned up upon closure.

Use Case

In my company, we frequently use Drawer components as form wrappers. Currently, after submitting or closing a form within a drawer, I handle the cleanup manually. This process involves resetting form states, which can get repetitive and error-prone. An optional destroyOnClose property would greatly simplify this by automatically unmounting the drawer content, ensuring a fresh state when reopened.

Proposed Solution

Add a destroyOnClose property that:

  • If true, unmounts the drawer content when closed.
  • If false or unspecified, maintains the current behavior.

Example API

<Drawer 
  open={isOpen}
  onClose={onClose}
  destroyOnClose
>
  <FormWrapper />
</Drawer>

Benefits

  • Simplifies cleanup for dynamic components inside drawers.
  • Reduces the need for manual state management.
  • Enhances developer productivity by automating common patterns.

Thanks for considering this request! Let me know if I can provide more details or help in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant