diff --git a/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts b/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts index a14aa03363c7..49df13aaf5ef 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/DefaultReconnectDisplay.ts @@ -26,7 +26,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay { rejoiningAnimation: HTMLDivElement; - reloadButton: HTMLButtonElement; + retryButton: HTMLButtonElement; resumeButton: HTMLButtonElement; @@ -65,10 +65,10 @@ export class DefaultReconnectDisplay implements ReconnectDisplay { this.status = document.createElement('p'); this.status.innerHTML = ''; - this.reloadButton = document.createElement('button'); - this.reloadButton.style.display = 'none'; - this.reloadButton.innerHTML = 'Retry'; - this.reloadButton.addEventListener('click', this.retry.bind(this)); + this.retryButton = document.createElement('button'); + this.retryButton.style.display = 'none'; + this.retryButton.innerHTML = 'Retry'; + this.retryButton.addEventListener('click', this.retry.bind(this)); this.resumeButton = document.createElement('button'); this.resumeButton.style.display = 'none'; @@ -77,7 +77,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay { this.dialog.appendChild(this.rejoiningAnimation); this.dialog.appendChild(this.status); - this.dialog.appendChild(this.reloadButton); + this.dialog.appendChild(this.retryButton); this.dialog.appendChild(this.resumeButton); this.overlay.appendChild(this.dialog); @@ -96,7 +96,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay { this.reconnect = options?.type === 'reconnect'; - this.reloadButton.style.display = 'none'; + this.retryButton.style.display = 'none'; this.rejoiningAnimation.style.display = 'block'; this.status.innerHTML = 'Rejoining the server...'; this.host.style.display = 'block'; @@ -114,7 +114,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay { this.status.innerHTML = `Rejoin failed... trying again in ${secondsToNextAttempt} ${unitText}`; } } else { - this.reloadButton.style.display = 'none'; + this.retryButton.style.display = 'none'; this.rejoiningAnimation.style.display = 'none'; this.status.innerHTML = 'The session has been paused by the server.'; this.resumeButton.style.display = 'block'; @@ -129,13 +129,13 @@ export class DefaultReconnectDisplay implements ReconnectDisplay { failed(): void { this.rejoiningAnimation.style.display = 'none'; if (this.reconnect) { - this.reloadButton.style.display = 'block'; + this.retryButton.style.display = 'block'; this.status.innerHTML = 'Failed to rejoin.
Please retry or reload the page.'; this.document.addEventListener('visibilitychange', this.retryWhenDocumentBecomesVisible); } else { this.status.innerHTML = 'Failed to resume the session.
Please reload the page.'; this.resumeButton.style.display = 'none'; - this.reloadButton.style.display = 'none'; + this.retryButton.style.display = 'none'; } } diff --git a/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts b/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts index 01106b9a6665..847f73436b7a 100644 --- a/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts +++ b/src/Components/Web.JS/src/Platform/Circuits/UserSpecifiedDisplay.ts @@ -29,6 +29,8 @@ export class UserSpecifiedDisplay implements ReconnectDisplay { private reconnect = false; + private remote = false; + constructor(private dialog: HTMLElement, private readonly document: Document, maxRetries?: number) { this.document = document; @@ -70,10 +72,10 @@ export class UserSpecifiedDisplay implements ReconnectDisplay { this.dispatchReconnectStateChangedEvent({ state: 'retrying', currentAttempt, secondsToNextAttempt }); } if (options.type === 'pause') { - const remote = options.remote; + this.remote = options.remote; this.dialog.classList.remove(UserSpecifiedDisplay.ShowClassName, UserSpecifiedDisplay.RetryingClassName); this.dialog.classList.add(UserSpecifiedDisplay.PausedClassName); - this.dispatchReconnectStateChangedEvent({ state: 'paused', remote: remote }); + this.dispatchReconnectStateChangedEvent({ state: 'paused', remote: this.remote }); } } @@ -90,7 +92,7 @@ export class UserSpecifiedDisplay implements ReconnectDisplay { this.dispatchReconnectStateChangedEvent({ state: 'failed' }); } else { this.dialog.classList.add(UserSpecifiedDisplay.ResumeFailedClassName); - this.dispatchReconnectStateChangedEvent({ state: 'resume-failed' }); + this.dispatchReconnectStateChangedEvent({ state: 'resume-failed', remote: this.remote }); } } diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Layout/ReconnectModal.razor.js b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Layout/ReconnectModal.razor.js index e52a190bacbb..9310c79fb692 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Layout/ReconnectModal.razor.js +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Layout/ReconnectModal.razor.js @@ -15,7 +15,7 @@ function handleReconnectStateChanged(event) { reconnectModal.close(); } else if (event.detail.state === "failed") { document.addEventListener("visibilitychange", retryWhenDocumentBecomesVisible); - } else if (event.detail.state === "rejected") { + } else if (event.detail.state === "rejected" || (event.detail.state === "resume-failed" && event.detail.remote === true)) { location.reload(); } }