From 9615468ae49da361e8faf650c619d6491668b8cd Mon Sep 17 00:00:00 2001 From: Chris Jordan Date: Thu, 5 Sep 2024 13:07:29 -0400 Subject: [PATCH] fix(url_hash_bindings): added debouce maxWait value for throttledSetUrlHash without a maxWait value, debounce can cause important state changes to be lost if there is high rate of state change between the important change and a page reload mouse movement causes state changes and is probably the main reason this can happen --- src/ui/url_hash_binding.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/url_hash_binding.ts b/src/ui/url_hash_binding.ts index 48d6e4009..5c338cb5e 100644 --- a/src/ui/url_hash_binding.ts +++ b/src/ui/url_hash_binding.ts @@ -82,6 +82,7 @@ export class UrlHashBinding extends RefCounted { const throttledSetUrlHash = debounce( () => this.setUrlHash(), updateDelayMilliseconds, + { maxWait: updateDelayMilliseconds * 2 }, ); this.registerDisposer(root.changed.add(throttledSetUrlHash)); this.registerDisposer(() => throttledSetUrlHash.cancel());