-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
Pillar: Complete Blazor WebPriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsdesign-proposalThis issue represents a design proposal for a different issue, linked in the descriptionThis issue represents a design proposal for a different issue, linked in the descriptionenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
Summary
Currently there is an issue with Blazor Server-side where it is not reconnecting circuits automatically and losing connection especially on mobile browsers.
Motivation and goals
- Automatically reload page on
Reconnection attempt to the circuit was rejected by the server. This may indicate that the associated state is no longer available on the server.
- Automatically reload page on mobile browsers that lost connection (probably due to browser tab being suspended), see Blazor Server Side. JS doesn't start after a long downtime on mobile browsers. #23340 Investigate behavior of Blazor Server on mobile when switching apps #26985
In scope
- Automatically refresh the page when circuit was rejected
- Add
onReconnectionFailed
event onReconnectionFailed
could be used to automatically refresh the page instead of asking user to do that manually like in a screenshot shown below- Change
DefaultReconnectionHandler.attemptPeriodicReconnection
to try to reconnect first and then delay, instead of delaying first and then trying to reconnect. (Possibly could fix Blazor Server Side. JS doesn't start after a long downtime on mobile browsers. #23340 Investigate behavior of Blazor Server on mobile when switching apps #26985)
Out of scope
Risks / unknowns
- Difficult to test on mobile browsers
Examples
DefaultReconnectionHandler.ts
async attemptPeriodicReconnection(options: ReconnectionOptions) {
for (let i = 0; i < options.maxRetries; i++) {
this.reconnectDisplay.update(i + 1);
const delayDuration = i == 0 && options.retryIntervalMilliseconds > ReconnectionProcess.MaximumFirstRetryInterval
? ReconnectionProcess.MaximumFirstRetryInterval
: options.retryIntervalMilliseconds;
this.logger.log(LogLevel.Debug, `Reconnecting in ${delayDuration}`);
await this.delay(delayDuration);
//code..
//try { reconnect() }
//instead of delaying 3000ms first and trying to reconnect later
//we could try to reconnect first and delay afterwards
//this could possibly fix reconnection on suspended mobile browsers
Example onReconnectionFailed
event default implementation
Blazor.defaultReconnectionHandler.onReconnectionFailed = function (d) {
document.location.reload();
}
I can take care of the implementation of this task.
Related issues
timbze, boukenka, vindberg, maciej-napora, JohnKiller and 35 more
Metadata
Metadata
Assignees
Labels
Pillar: Complete Blazor WebPriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsdesign-proposalThis issue represents a design proposal for a different issue, linked in the descriptionThis issue represents a design proposal for a different issue, linked in the descriptionenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one