Skip to content

Commit

Permalink
fix(url_hash_bindings): added debouce maxWait value for throttledSetU…
Browse files Browse the repository at this point in the history
…rlHash

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
  • Loading branch information
chrisj committed Sep 5, 2024
1 parent 5c901ef commit 9615468
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/ui/url_hash_binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 9615468

Please sign in to comment.