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

unmountOnHide doesn't respect closing animation when Dialog is used without explicit store #3403

Open
Dremora opened this issue Jan 29, 2024 · 1 comment · May be fixed by #3531
Open

unmountOnHide doesn't respect closing animation when Dialog is used without explicit store #3403

Dremora opened this issue Jan 29, 2024 · 1 comment · May be fixed by #3531

Comments

@Dremora
Copy link
Sponsor

Dremora commented Jan 29, 2024

Current behavior

Closing a dialog that has open, onClose and unmountOnHide props (see example below) doesn't wait for the closing animation before unmounting. When using store and unmountOnHide props, everything works as expected.

Steps to reproduce the bug

  1. Open https://stackblitz.com/edit/gntorz?file=dialog-animated%2Fstyle.css,dialog-animated%2Findex.tsx&theme=dark
  2. Click the first button and then dismiss the dialog - it animates correctly
  3. Click the second button and then dismiss the dialog - there's no closing animation

Expected behavior

Dialogs should finish animation regardless of whether store is passed as a prop or is created internally.

Workaround

Construct useStore manually.

#3403 (comment)

Possible solutions

No response

@diegohaz
Copy link
Member

diegohaz commented Jan 29, 2024

At the moment, if a store isn't provided (either through the store prop or by wrapping the dialog with DialogProvider), the Dialog's open prop is the sole data available for unmountOnHide to determine whether it should unmount the underlying component.

This ensures we run as little code as possible when the dialog is unmounted. But we can potentially support this in the future.

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

Successfully merging a pull request may close this issue.

2 participants