diff --git a/packages/lexical-playground/src/hooks/useReport.ts b/packages/lexical-playground/src/hooks/useReport.ts index 27965735864..6f89d9f00c3 100644 --- a/packages/lexical-playground/src/hooks/useReport.ts +++ b/packages/lexical-playground/src/hooks/useReport.ts @@ -36,8 +36,9 @@ export default function useReport(): ( ) => ReturnType { const timer = useRef | null>(null); const cleanup = useCallback(() => { - if (timer !== null) { - clearTimeout(timer.current as ReturnType); + if (timer.current !== null) { + clearTimeout(timer.current); + timer.current = null; } if (document.body) { @@ -54,7 +55,9 @@ export default function useReport(): ( // eslint-disable-next-line no-console console.log(content); const element = getElement(); - clearTimeout(timer.current as ReturnType); + if (timer.current !== null) { + clearTimeout(timer.current); + } element.innerHTML = content; timer.current = setTimeout(cleanup, 1000); return timer.current;