diff options
author | Miodec <[email protected]> | 2024-11-04 09:58:19 +0100 |
---|---|---|
committer | Miodec <[email protected]> | 2024-11-04 10:46:40 +0100 |
commit | d448af8d6f08ec3839213802e98890d8631b4014 (patch) | |
tree | de7befc9678263737ab749f62ee029b24835c135 | |
parent | 273650031021b7394d7eee4591c38edd364d9994 (diff) | |
download | monkeytype-d448af8d6f08ec3839213802e98890d8631b4014.tar.gz monkeytype-d448af8d6f08ec3839213802e98890d8631b4014.zip |
fix: offline banner sometimes not being hidden when coming back online
-rw-r--r-- | frontend/src/ts/states/connection.ts | 10 |
1 files 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"); |