1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Fix settings toggles sometimes not being toggable

Co-authored-by: William Oldham <github@binaryoverload.co.uk>
This commit is contained in:
mrjvs 2023-12-21 21:00:36 +01:00
parent 690b1c6e68
commit 0e830ee0a6

View file

@ -24,7 +24,7 @@ export function useDerived<T>(
const setter = useCallback<Dispatch<SetStateAction<T>>>(
(inp) => {
if (!(inp instanceof Function)) setOverwrite(inp);
else setOverwrite((s) => inp(s ?? initial));
else setOverwrite((s) => inp(s !== undefined ? s : initial));
},
[initial, setOverwrite]
);