From ade9a4961a608668803ff5acce7a35068c095ae4 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Thu, 18 Sep 2025 11:45:54 +0200 Subject: [PATCH] fix: update keysDownState handling --- ui/src/hooks/useKeyboard.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/src/hooks/useKeyboard.ts b/ui/src/hooks/useKeyboard.ts index b118c97f..2c3d629d 100644 --- a/ui/src/hooks/useKeyboard.ts +++ b/ui/src/hooks/useKeyboard.ts @@ -87,7 +87,7 @@ export default function useKeyboard() { } // On older backends, we need to set the keysDownState manually since without the hidRpc API, the state doesn't trickle down from the backend - setKeysDownState(MACRO_RESET_KEYBOARD_STATE); + setKeysDownState({ modifier, keys }); }); }, [send, setKeysDownState], @@ -155,7 +155,7 @@ export default function useKeyboard() { const ac = new AbortController(); setAbortController(ac); - + for (const [_, step] of steps.entries()) { const keyValues = (step.keys || []).map(key => keys[key]).filter(Boolean); const modifierMask: number = (step.modifiers || []) @@ -167,7 +167,7 @@ export default function useKeyboard() { promises.push(() => sendKeystrokeLegacy(keyValues, modifierMask, ac)); promises.push(() => resetKeyboardState()); promises.push(() => sleep(step.delay || 100)); - } + } } const runAll = async () => { @@ -185,9 +185,9 @@ export default function useKeyboard() { const abortListener = () => { reject(new Error("Macro execution aborted")); }; - + ac.signal.addEventListener("abort", abortListener); - + runAll() .then(() => { ac.signal.removeEventListener("abort", abortListener);