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