C
C#10mo ago
Allan

Blazor Server: recommendations for Production use

Hello! I'm building a Blazor Server app that's gonna be used on mobile browsers. I have some questions to properly configure it and avoid as much issues as possible. I noticed when you are not focused on the browser on mobile, the WebSocket connections are interrupted, leading to timeouts and reconnects. The main issue I have is that when it timeouts, it attempts to reconnect (good thing!) but once it has reconnected, it re-renders the page entirely, leading to things like forms being lost. Is the good practice implementing this: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/prerendering-and-integration?view=aspnetcore-7.0&pivots=server#persist-prerendered-state or is there something I have missed? I'm also looking to know what I should do regarding handshake and keepalive timeouts... thanks!
1 Reply
Allan
Allan10mo ago
bump 🙃 I tried implementing the PersistingComponentState but when I lose connection with the server the PersistAsync is never called I guess I could try storing the state I need to save in the local storage, but how can I do it without duplicating my code every time I have forms?