diff --git a/openless-all/app/src/components/AudioCue.tsx b/openless-all/app/src/components/AudioCue.tsx index e3f5f4ad..128f2647 100644 --- a/openless-all/app/src/components/AudioCue.tsx +++ b/openless-all/app/src/components/AudioCue.tsx @@ -46,7 +46,7 @@ export function AudioCueListener() { listen('prefs:changed', (event) => { const next = event.payload; if (next) audioCueEnabledRef.current = next.audioCueOnRecord !== false; - }).then(fn => { if (!cancelled) unlisten = fn; }).catch(() => {}); + }).then(fn => { if (cancelled) fn(); else unlisten = fn; }).catch(() => {}); })(); return () => { cancelled = true; unlisten?.(); }; }, [audioCueRuntimeEnabled]); @@ -73,7 +73,7 @@ export function AudioCueListener() { } else if (state !== 'recording' && prev === 'recording') { stopAudioCue(); } - }).then(fn => { if (!cancelled) unlisten = fn; }).catch(() => {}); + }).then(fn => { if (cancelled) fn(); else unlisten = fn; }).catch(() => {}); })(); return () => { cancelled = true; unlisten?.(); }; }, [audioCueRuntimeEnabled]); diff --git a/openless-all/app/src/components/WindowChrome.tsx b/openless-all/app/src/components/WindowChrome.tsx index a6e6c6e4..0c8fa084 100644 --- a/openless-all/app/src/components/WindowChrome.tsx +++ b/openless-all/app/src/components/WindowChrome.tsx @@ -113,7 +113,8 @@ function LinuxTitlebar() { if (!cancelled) setMaximized(m); }).catch(() => {}); }).then((fn) => { - if (!cancelled) unlisten = fn; + if (cancelled) fn(); + else unlisten = fn; }).catch(() => {}); }).catch(() => {}); return () => {