diff --git a/src/hooks/useNetworkedState.ts b/src/hooks/useNetworkedState.ts index 294430e..8f201f6 100644 --- a/src/hooks/useNetworkedState.ts +++ b/src/hooks/useNetworkedState.ts @@ -48,16 +48,14 @@ function useNetworkedState( const forceUpdateRef = useRef(false); // Update dirty at the same time as state - const setState = useCallback>((update, sync, force) => { - dirtyRef.current = sync || false; - forceUpdateRef.current = force || false; - _setState(update); - }, []); - - const eventNameRef = useRef(eventName); - useEffect(() => { - eventNameRef.current = eventName; - }, [eventName]); + const setState = useCallback>( + (update, sync = true, force = false) => { + dirtyRef.current = sync; + forceUpdateRef.current = force; + _setState(update); + }, + [] + ); const debouncedState = useDebounce(state, debounceRate); const lastSyncedStateRef = useRef();