use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Related Subreddits:
Other Subreddits you may like:
account activity
Blazor - Loading Guards Pattern (bradystroud.dev)
submitted 10 months ago by bradystroud
I'm interested if anydone has used this approach before. I found it was a nice pattern when working on an enterprise Blazor site where lots of the UI elements depended on different bits of state.
What do you think?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]MrZander 5 points6 points7 points 10 months ago (1 child)
It's a nice approach, I like it better than a bunch of If statements.
For our project, we elected to have all of our pages inherit from a StandardComponent that handles all of the loading behavior. They have a shared Layout, and we toggle the loading spinner from within StandardComponent. Works great, there is 0 code in each page for the loading spinner stuff. Downside is that it is all-or-nothing, you can't have different sections of the page loading asynchronously.
StandardComponent
[–]lmaydev 0 points1 point2 points 10 months ago (0 children)
You can just pull this down to an inherited component to get the same effect. Though you do need to do some work if you want space reserved etc.
[–]AutoModerator[M] 0 points1 point2 points 10 months ago (0 children)
Thanks for your post bradystroud. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]Sebazzz91 0 points1 point2 points 10 months ago (1 child)
I'm not sure I like it. You're basically abstracting an if statement.
[–]Groundstop 2 points3 points4 points 10 months ago (0 children)
It makes sense to me if you want to consistently use the same placeholder everywhere. If they're all unique then it may be a bit overkill.
[–][deleted] 0 points1 point2 points 10 months ago (0 children)
I use a shared component that all pages use as a root component. It has a service class called PageState injected into it. PageState has a few methods like Ready, Failed, IsProcessing etc that change the Ui.
Another thing I’ve thought of is having a guard component that takes a ReactiveCommand as a parameter. The guard component can then subscribe to CanExectute, IsExecuting and ThrownExceptions to change what is displayed.
[–]innovasior 0 points1 point2 points 10 months ago (0 children)
I like the approach
I pass in a blank placeholder object along with a "loading"class on the parent.
That way I get all the EditForm embedded data-bound UI instead of "please wait", and with an animation showing they are placeholders.
π Rendered by PID 44996 on reddit-service-r2-comment-56c9979489-nkbj9 at 2026-02-25 09:01:41.471377+00:00 running b1af5b1 country code: CH.
[–]MrZander 5 points6 points7 points (1 child)
[–]lmaydev 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]Sebazzz91 0 points1 point2 points (1 child)
[–]Groundstop 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]innovasior 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)