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

[@mantine/modals] Fixed closeModal async logic #3300

Merged
merged 1 commit into from Jan 17, 2023

Conversation

Njiallu
Copy link
Contributor

@Njiallu Njiallu commented Jan 6, 2023

Closes #3289

Made the logic simpler and not assume that the closed modal is the last in the stack.

@rtivital rtivital merged commit a5ee0a4 into mantinedev:master Jan 17, 2023
@rtivital
Copy link
Member

Thanks!

@D3SOX
Copy link
Contributor

D3SOX commented Jan 17, 2023

When trying to close a modal like this

const submit = () => ctx.closeModal(id);
const id = ctx.openModal(
  ...
  children: <Button onClick={submit}>Submit</Button>
);

I get an Uncaught TypeError: modal is undefined

@cyantree
Copy link
Contributor

cyantree commented Feb 5, 2023

@D3SOX FYI, I've taken another shot at this and also investigated your reported behaviour: #3498 (comment)

cyantree added a commit to cyantree/mantine that referenced this pull request Feb 5, 2023
rtivital pushed a commit that referenced this pull request Feb 15, 2023
* [@mantine/modals] Fix various issues regarding usage assumptions

* [@mantine/modals] Make sure methods in ModalsContext always use the current state (#3300) (#3498)

* [@mantine/modals] Cache static methods in ModalsContext to reduce rerenderings
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.

Modals manager doesn't handle closing modals properly
4 participants