-
I'm having an issue with a .NET 6 Blazor server application where users who have high server latency (such as on a cell phone with a poor connection) are able to click the 'show modal button' multiple times before the modal is displayed. When this occurs, they then begin to get multiple modals, one on top of another, for each time they were able to click the button. I've tried a number of solutions:
Unfortunately I've had issues with all of the above, because any attempts that I've tried to then 're-enable the button after the modal is showing' seem to occur prematurely, allowing for multiple clicks of the button to still get through. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
While ultimately Blazor WASM would likely be the better choice for an application that might have to deal with high user latency, I believe I've been able to resolve this in my Blazor server application by taking advantage of Blazored Modal's ability to return data, such as when the modal has been closed. Basically I set an 'isModalShowing' flag to true when the button to show the modal is first clicked. Once that's set to true it will catch any additional clicks. I then I await the modal.Result.Data, which will be returned when the modal is eventually closed. Once I receive the result I know the modal has been closed and I can then continue execution which will set the 'isModalShowing' flag to false to allow for the the modal to be displayed again if needed. In MyComponent:
In MyModal:
|
Beta Was this translation helpful? Give feedback.
While ultimately Blazor WASM would likely be the better choice for an application that might have to deal with high user latency, I believe I've been able to resolve this in my Blazor server application by taking advantage of Blazored Modal's ability to return data, such as when the modal has been closed.
Basically I set an 'isModalShowing' flag to true when the button to show the modal is first clicked. Once that's set to true it will catch any additional clicks. I then I await the modal.Result.Data, which will be returned when the modal is eventually closed. Once I receive the result I know the modal has been closed and I can then continue execution which will set the 'isModalShowing' f…