Fix network state default sync value
This commit is contained in:
parent
3dfb1186f9
commit
e3d757ac42
@ -48,16 +48,14 @@ function useNetworkedState<S extends { readonly [x: string]: any } | null>(
|
|||||||
const forceUpdateRef = useRef(false);
|
const forceUpdateRef = useRef(false);
|
||||||
|
|
||||||
// Update dirty at the same time as state
|
// Update dirty at the same time as state
|
||||||
const setState = useCallback<SetNetworkedState<S>>((update, sync, force) => {
|
const setState = useCallback<SetNetworkedState<S>>(
|
||||||
dirtyRef.current = sync || false;
|
(update, sync = true, force = false) => {
|
||||||
forceUpdateRef.current = force || false;
|
dirtyRef.current = sync;
|
||||||
_setState(update);
|
forceUpdateRef.current = force;
|
||||||
}, []);
|
_setState(update);
|
||||||
|
},
|
||||||
const eventNameRef = useRef(eventName);
|
[]
|
||||||
useEffect(() => {
|
);
|
||||||
eventNameRef.current = eventName;
|
|
||||||
}, [eventName]);
|
|
||||||
|
|
||||||
const debouncedState = useDebounce(state, debounceRate);
|
const debouncedState = useDebounce(state, debounceRate);
|
||||||
const lastSyncedStateRef = useRef<S>();
|
const lastSyncedStateRef = useRef<S>();
|
||||||
|
Loading…
Reference in New Issue
Block a user