❔ Blazor State Container Prompt, Standardized for all Pages
I have a simple state container in blazor. The goal is to provide the AppEntity value:
The container is injected in the services collection.
I have a component which provides the user a selection dropdown to set the AppEntity in the State Container. Subsequent pages inject the State Container and use it if needed.
My question is: if for some reason a page that requires the State Container has a null value for AppEntity (e.g., user navigated to a specific page by url, bypassing the selection page), how can I have a generic popup prompt that prompts the user for the selection? Ideally, I'd want to minimize the code in any page that needs it as much as possible. The only way I can think to do this is to build the prompt in a base component and inherit from it, but perhaps there might be a simpler or more elegant way.
2 Replies
I always ask the weird questions 😅 .
I think I figured this one out though. Just need to create a component that checks if state container is empty and prompts selection box if it is via popup/dialog. Then I just include that component in each page that needs it.
Sometimes my mind wanders in a completely direction, and I begin to think it's more complicated. ah well 😄
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.