From a33ce67dd4a3f5095eb32a4fb70bd999ed703661 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 15 Mar 2023 23:01:56 +0100 Subject: [PATCH] fix: endless preview --- website/src/repl/Footer.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/src/repl/Footer.jsx b/website/src/repl/Footer.jsx index 187aca18..2bce3e70 100644 --- a/website/src/repl/Footer.jsx +++ b/website/src/repl/Footer.jsx @@ -248,9 +248,10 @@ function SoundsTab() { const trigRef = useRef(); // stop current sound on mouseup useEvent('mouseup', () => { - trigRef.current?.then((ref) => { + const t = trigRef.current; + trigRef.current = undefined; + t?.then((ref) => { ref?.stop(getAudioContext().currentTime + 0.01); - trigRef.current = undefined; }); }); return (