Reconnection will almost never work #11999
Labels
area-blazor
Includes: Blazor, Razor Components
bug
This issue describes a behavior which is not expected - a bug.
Done
This issue has been fixed
Milestone
This comes out of #11793 where I'm trying to pin down what will make people actually successful at handling connection instability and migration of state across servers.
We've invested a lot in making server-side Blazor circuits theoretically capable of reconnecting and continuing after a transient connection loss, but with the current implementation, it gives up permanently if the first auto-reconnect attempt fails. And it continues to show the "Retry?" button which will do nothing if you click it.
This is because in
Boot.Server.ts
, the flow looks like:reconnect
, which in turn callsconnection.start
connection.start
will throw (assuming the network connection hasn't been restored already, and remember, we only waited 3 seconds so it almost certainly hasn't been).unhandledError
, which sets a flagrenderingFailed = true
reconnect
just bail out immediately without doing anything because of therenderingFailed
flag.So the timer which calls
reconnect
every 3 seconds won't do anything, and the "Retry?" button which also callsreconnect
won't do anything.Minimal fixes
As an absolute minimum, assuming we want to ship reconnection as a feature for 3.0, I think we must do the following. This is not a suggestion of the best UX; it's the smallest set of improvements I think we could ship with.
unhandledError
frominitializeConnection
, and instead catching upsteam, might be enough for that.Better fixes
If we wanted better reconnection UX, we should
sessionStorage
to say we did an auto-reload, clear that flag the next time a connection is successful, and don't do an auto-reload any time the flag is still there.I recognize that some of this duplicates #10496 and #9256. They are down as
3.1.0
andbacklog
respectively, but I'm not convinced this is a shippable feature without addressing at least the "minimal fixes" above.The text was updated successfully, but these errors were encountered: