-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
[Feature Request] Add OnBeforeClose hook. #540
Comments
Hey @MarcelRoozekrans, thanks for your request. I'm just trying to understand the use case. When opening a modal it looks something like this: var moviesModal = Modal.Show<Movies>("My Movies");
var result = await moviesModal.Result;
if (result.Cancelled)
{
Console.WriteLine("Modal was cancelled");
}
else if (result.Confirmed)
{
Console.WriteLine("Modal was closed");
} What benefit would a |
Hi @chrissainty, Thanks for the response ! This proposed solution is that you can execute an action before the dialog is closed. With your example above the dialog is closed first and the afterwards de logic is executed. We need this because when the modal is closed I want to directly update the parent page. The actions we do in de OnBeforeClose take significant amount of time and there for the parent page has a ugly redraw with the new state way after the dialog is closed. |
I'm in full support for this feature, with a small addition. I'm currently working on an application where we need to show a "Are you sure you want to close this"-modal in case any changes has been made inside a that has been commanded to close. Currently we have to disable closing this modal by the x in the top or clicking outside. Then we add our own close button to the modal window and trigger the "Are you sure" modal using that button. We would love to allow the the user to close the modal by clicking outside, but to do that we need this hook to run our own modal code first. The addition we would love is the ability to stop the closing of the modal using this hook. Maybe this hook could return a bool or something, that could stop the closing process, so any changes inside the modal isn't disposed of. |
@chrissainty Is it a possibility we can help with this issue and get it prioritized? :) |
Is your feature request related to a problem? Please describe.
We have an application where we want to execute code at then end of the dialog. The logic that now closes first the dialog and adfter that we can execute some custom logic.
Describe the solution you'd like
A OnBeforeClosing hook so we can execute code that runs behind the opened dialog.
Describe alternatives you've considered
There are none I can think of.
Additional context
I'll open a PR that implements this feature.
The text was updated successfully, but these errors were encountered: