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
This is not a bug. I am hoping there is a best-practice answer for this. We have a scenario where a page loads as SSR, but then the interactive Blazor server component takes over. We need to call an API to a secured endpoint from the interactive component. We already have the access token during the SSR call. We create a scoped service and use that to save the access token when the SSR page loads. Then, we can get the access token back from that service in the interactive component to make the calls to the API. Is it ok to assume that a scoped service will stay between a SSR call and the Signal R session. If not, how do you share data between SSR and Signal R session. We saw that we could use the persist pre-render state but not sure if that is a better way. Thanks in advance for help.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
dotnet8
Anything else?
No response
The text was updated successfully, but these errors were encountered:
No, the scope is not shared between the initial SSR request and Blazor Server. Blazor already has a feature to persist prerendered component state (link below) and we are working to make it work on Blazor Web too (no need for the tag helper, it happens automatically).
Hello @javiercn - thanks so much for your response. Could you please clarify where we should add the today for a blazor web app, as the index and host page don't exist? Also, it seems that the docs might not be correct for the Webassembly section. There are referring to the _host page here.
Is there an existing issue for this?
Describe the bug
This is not a bug. I am hoping there is a best-practice answer for this. We have a scenario where a page loads as SSR, but then the interactive Blazor server component takes over. We need to call an API to a secured endpoint from the interactive component. We already have the access token during the SSR call. We create a scoped service and use that to save the access token when the SSR page loads. Then, we can get the access token back from that service in the interactive component to make the calls to the API. Is it ok to assume that a scoped service will stay between a SSR call and the Signal R session. If not, how do you share data between SSR and Signal R session. We saw that we could use the persist pre-render state but not sure if that is a better way. Thanks in advance for help.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
dotnet8
Anything else?
No response
The text was updated successfully, but these errors were encountered: