From 41c6da86e31b15c19d51037cb5e2192a346b80e1 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Mon, 23 Dec 2024 11:17:29 +0100 Subject: [PATCH] fix: stuck flashes --- packages/cm-eval/lib/flashField.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/cm-eval/lib/flashField.ts b/packages/cm-eval/lib/flashField.ts index 0f2ebde5..5e04a970 100644 --- a/packages/cm-eval/lib/flashField.ts +++ b/packages/cm-eval/lib/flashField.ts @@ -3,8 +3,6 @@ import { StateField, StateEffect } from "@codemirror/state"; type FlashRange = [number, number]; -let timeoutId: any; - export const setFlash = StateEffect.define(); const defaultStyle = { @@ -23,9 +21,8 @@ export const flash = ( timeout: number = 150 ) => { if (from === null || to === null) return; - clearTimeout(timeoutId); view.dispatch({ effects: setFlash.of([from, to]) }); - timeoutId = setTimeout(() => { + setTimeout(() => { view.dispatch({ effects: setFlash.of(null) }); }, timeout); };