Fix keybind onChange

This commit is contained in:
Zerebos 2024-12-08 12:05:51 -05:00
parent 76b5eb7906
commit f747ad5846
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -39,8 +39,11 @@ export default function Keybind({value: initialValue, onChange, max = 4, clearab
event.stopPropagation();
event.preventDefault();
if (event.key === state.accum[0]) setState({value: state.accum.slice(0), isRecording: false, accum: []});
}, [state]);
if (event.key === state.accum[0]) {
onChange?.(state.accum);
setState({value: state.accum.slice(0), isRecording: false, accum: []});
}
}, [state, onChange]);
const clearKeybind = useCallback((event) => {
event.stopPropagation();