-
-
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
[Bug] Blazor Server - Modal cannot be closed in background thread #504
Comments
This also happens when Show() is called from a Timer Event. Show() needs to be done from the UI Thread. I have a MAUI Blazor Hybrid App. When I call Show() from the Main Thread (via MainThread.BeginInvokeOnMainThread) then it works a expected. If I call Show() without switching to the Main Thread it behaves as described above. Thanks in advance for your help. Addendum: Thinking about it, maybe it's just that Show() and Close() need to be made from the same (not necessarily the UI-) Thread. |
I have created a workaround in my app that enforces the Show() and Hide() to the UI-Thread by routing it to a Component and call them through InvokeAsync(). This works. |
Hi @UweReisewitz. The handler for the event triggered by the Modal/src/Blazored.Modal/BlazoredModal.razor Line 138 in f27ab5f
|
Hi, @chrissainty, |
I also had this issue. I had a modal that I wanted to close based on a timer. But the timer was indeed running on a different thread. First i thought the issue was in the following piece of code. I thought
Now I've resolved it by doing the
@chrissainty maybe you can add this trick to the documentation? |
Describe the bug
I am working on a Blazor Server + RabbitMQ application (with Rebus package), when a new message arrives to the Consumer I need a modal to be opened and after the process is finished the modal is closed, the modal works perfectly when the method is called
Modal.Show<DisplayMessage>()
but doesn't work when it needs to be closedmodal.Close()
.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The modal would have to be closed once we call the method .close
Hosting Model (is this issue happening with a certain hosting model?):
Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: