Skip to content

fix: Unwarp Dialog promises created by confirm, prompt, and alert to enable closing these dialogs imperatively#4801

Merged
Janpot merged 1 commit intomui:masterfrom
DizWARE:unwrap-wrapper-functions
Mar 26, 2025
Merged

fix: Unwarp Dialog promises created by confirm, prompt, and alert to enable closing these dialogs imperatively#4801
Janpot merged 1 commit intomui:masterfrom
DizWARE:unwrap-wrapper-functions

Conversation

@DizWARE
Copy link
Contributor

@DizWARE DizWARE commented Mar 24, 2025

Because the useCallback utilized async declarations around wrapping the open() function, it created a new Promise around the return value of open() making it impossible for consumers to utilize the promise to call close() because the promise ref no longer matched

Signed-off-by: Tyler Robinson [email protected]
Update useDialogs.test.tsx

Signed-off-by: Tyler Robinson [email protected]
Clean up

Before applying the fix:

image

After applying the fix:

image

  • I've read and followed the contributing guide on how to create great pull requests.
    - [ ] I've updated the relevant documentation for any new or updated feature. - Not relevant
    - [ ] I've linked relevant GitHub issue with "Closes #". - Not relevant
  • I've added a visual demonstration in the form of a screenshot or video.

@mui-bot
Copy link

mui-bot commented Mar 24, 2025

Netlify deploy preview

https://deploy-preview-4801--mui-toolpad-docs.netlify.app/

Generated by 🚫 dangerJS against c5ee586

@DizWARE DizWARE changed the title Unwarp Dialog promises created by confirm, prompt, and alert fix: Unwarp Dialog promises created by confirm, prompt, and alert Mar 24, 2025
@DizWARE DizWARE changed the title fix: Unwarp Dialog promises created by confirm, prompt, and alert fix: Unwarp Dialog promises created by confirm, prompt, and alert to enable closing these dialogs imperatively Mar 24, 2025
@DizWARE
Copy link
Contributor Author

DizWARE commented Mar 24, 2025

I seem to be disallowed from adding a label to the PR. I did not open an issue first, just due to this being a fairly clean cut issue, which the contribution guide seems to support these types of contributions. If I need to create an issue, let me know

@DizWARE DizWARE force-pushed the unwrap-wrapper-functions branch from 6a2843e to 3dbff2e Compare March 24, 2025 22:16
Because the useCallback utilized async declarations around wrapping the open() function, it created a new Promise around the return value of open() making it impossible for consumers to utilize the promise to call `close()` because the promise ref no longer matched

Signed-off-by: Tyler Robinson
@DizWARE DizWARE force-pushed the unwrap-wrapper-functions branch from 3dbff2e to c5ee586 Compare March 25, 2025 15:04
Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@Janpot Janpot merged commit 8d7ba4b into mui:master Mar 26, 2025
15 checks passed
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

Successfully merging this pull request may close these issues.

3 participants