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

How do I prevent a dynamic modal closing using an async onBeforeClose? #458

Open
beard7 opened this issue Nov 18, 2024 · 0 comments
Open
Assignees
Labels
question Further information is requested

Comments

@beard7
Copy link

beard7 commented Nov 18, 2024

I using UseModal() to create a dynamic modals with edit forms for a data grid. It's working really well, but I've hit a snag.

I need to display a warning before closing the modal if the form has changed (and is not being saved). The warning uses an async method to await for user confirmation, so I'm trying this:

...
onBeforeClose: async (ev) => { 
    const close = await beforeEditModalClose();
    if (!close) {
        ev.stop();
    }
}
...

the modal is closing before I've got the result from beforeEditModalClose()

Any suggeestions? Thanks

@beard7 beard7 added the question Further information is requested label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants