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:
parent
690b1c6e68
commit
0e830ee0a6
1 changed files with 1 additions and 1 deletions
|
@ -24,7 +24,7 @@ export function useDerived<T>(
|
||||||
const setter = useCallback<Dispatch<SetStateAction<T>>>(
|
const setter = useCallback<Dispatch<SetStateAction<T>>>(
|
||||||
(inp) => {
|
(inp) => {
|
||||||
if (!(inp instanceof Function)) setOverwrite(inp);
|
if (!(inp instanceof Function)) setOverwrite(inp);
|
||||||
else setOverwrite((s) => inp(s ?? initial));
|
else setOverwrite((s) => inp(s !== undefined ? s : initial));
|
||||||
},
|
},
|
||||||
[initial, setOverwrite]
|
[initial, setOverwrite]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue