Hide 'Connection established' when connection to server come back (#5352)

This commit is contained in:
Nicolas Dorier 2023-09-26 16:40:02 +09:00 committed by GitHub
parent 0a956fdc73
commit 16433dc183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -391,11 +391,17 @@ if (window.Blazor) {
$title.textContent = isConnected ? 'Connection established' : 'Connection interrupted'; $title.textContent = isConnected ? 'Connection established' : 'Connection interrupted';
$body.innerHTML = isConnected ? '' : 'Please <a href="">refresh the page</a>.'; // use empty link on purpose $body.innerHTML = isConnected ? '' : 'Please <a href="">refresh the page</a>.'; // use empty link on purpose
$body.classList.toggle('d-none', isConnected); $body.classList.toggle('d-none', isConnected);
if (!isConnected && !isUnloading) { if (!isUnloading) {
const toast = new bootstrap.Toast($status, { autohide: false }); const toast = new bootstrap.Toast($status, { autohide: false });
if (isConnected) {
if (toast.isShown())
toast.hide();
}
else {
if (!toast.isShown()) if (!toast.isShown())
toast.show(); toast.show();
} }
}
}); });
} }
delay(durationMilliseconds) { delay(durationMilliseconds) {