
I was working on the UI of a Blazor Server project the other day and had this cycle going on:
- Run my application without a debugger attached (CTRL + F5 in Visual Studio)
Quick note on this, if you don’t do this you have to rebuild the project yourself before changes are visible.
- Make a few changes
- Reload browser to see the changes
- Repeat from step 2
I would love to see the browser refresh automatically after making a change, unfortunately that is not yet available in VS and third party (JavaScript) solutions I have tried didn’t actually work.
After a little search I found that Blazor has a public API, containing everything I needed to have the browser reload when it loses the SignalR connection.
This is a really simple implementation and it might not work for your use case. Let me know if this is helpful to you or if you have a better alternative!