From d448af8d6f08ec3839213802e98890d8631b4014 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 4 Nov 2024 09:58:19 +0100 Subject: [PATCH] fix: offline banner sometimes not being hidden when coming back online --- frontend/src/ts/states/connection.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/states/connection.ts b/frontend/src/ts/states/connection.ts index 5b1d0b966..81ec0c873 100644 --- a/frontend/src/ts/states/connection.ts +++ b/frontend/src/ts/states/connection.ts @@ -1,4 +1,4 @@ -import { throttle } from "throttle-debounce"; +import { debounce } from "throttle-debounce"; import * as Notifications from "../elements/notifications"; import * as ConnectionEvent from "../observables/connection-event"; import * as TestState from "../test/test-state"; @@ -29,12 +29,12 @@ export function showOfflineBanner(): void { } } -const throttledHandleState = throttle(10000, () => { +const throttledHandleState = debounce(5000, () => { if (state) { - Notifications.add("You're back online", 1, { - customTitle: "Connection", - }); if (noInternetBannerId !== undefined) { + Notifications.add("You're back online", 1, { + customTitle: "Connection", + }); $( `#bannerCenter .banner[id="${noInternetBannerId}"] .closeButton` ).trigger("click");