PR feedback: Default LED state in store

This commit is contained in:
Marc Brooks 2025-09-04 12:18:39 -05:00
parent 28249fcae9
commit 958028716d
No known key found for this signature in database
GPG Key ID: 583A6AF2D6AE1DC6
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ function KeyboardWrapper() {
}, [keysDownState]);
const isCapsLockActive = useMemo(() => {
return keyboardLedState?.caps_lock || false;
return keyboardLedState.caps_lock;
}, [keyboardLedState]);
const mainLayoutName = useMemo(() => {

View File

@ -463,7 +463,7 @@ export interface HidState {
}
export const useHidStore = create<HidState>(set => ({
keyboardLedState: {} as KeyboardLedState,
keyboardLedState: { num_lock: false, caps_lock: false, scroll_lock: false, compose: false, kana: false, shift: false } as KeyboardLedState,
setKeyboardLedState: (ledState: KeyboardLedState): void => set({ keyboardLedState: ledState }),
keysDownState: { modifier: 0, keys: [0,0,0,0,0,0] } as KeysDownState,