fix: Unwarp Dialog promises created by confirm, prompt, and alert to enable closing these dialogs imperatively#4801
Merged
Janpot merged 1 commit intomui:masterfrom Mar 26, 2025
Conversation
Netlify deploy preview |
Contributor
Author
|
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 |
6a2843e to
3dbff2e
Compare
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
3dbff2e to
c5ee586
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 matchedSigned-off-by: Tyler Robinson [email protected]
Update useDialogs.test.tsx
Signed-off-by: Tyler Robinson [email protected]
Clean up
Before applying the fix:
After applying the fix:
- [ ] I've updated the relevant documentation for any new or updated feature.- Not relevant- [ ] I've linked relevant GitHub issue with "Closes #".- Not relevant