You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my .NET 8.0 Blazor Server app, I have the following scoped service:
And a middleware that initializes the
Value1
:The service is properly registered and the middleware is added to the request pipeline before Blazor pages.
Finally, I have a Blazor component
Home.razor
that tries to access theValue1
by dependency-injectingService1
:When I launch the app and navigate to the home page, "Hello, world!" appears for less than a second before it is replaced by "Unknown".
Screen.Recording.2024-08-19.at.20.10.06.mov
I assume that the
Value1
can be accessed during pre-rendering (and SSR), but why does it go away when switching to interactive rendering?How should I deal with this problem? Is there a workaround to pass a value from middleware to an interactive Blazor component?
The source code in case you need it:
https://dropover.cloud/f3577f
Beta Was this translation helpful? Give feedback.
All reactions