Apply suggestions from code review

Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
Sidharth Vinod
2022-09-10 20:51:21 +05:30
committed by GitHub
co-authored by Alois Klink
parent 01483420c9
commit fc533d8e11
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ export const toggleDarkTheme = (dark: boolean): void => {
let urlDebounce: number;
export const initURLSubscription = (): void => {
stateStore.subscribe(({ serialized }) => {
clearInterval(urlDebounce);
clearTimeout(urlDebounce);
urlDebounce = window.setTimeout(() => {
history.replaceState(undefined, undefined, `#${serialized}`);
}, 250);
+1 -1
View File
@@ -53,7 +53,7 @@ const timeouts: Record<string, number> = {};
export const logEvent = (name: string, data?: unknown): void => {
if (analytics) {
const key = data ? JSON.stringify({ name, data }) : name;
clearInterval(timeouts[key]);
clearTimeout(timeouts[key]);
timeouts[key] = window.setTimeout(() => {
void analytics.track(name, data);
}, 5000);