diff --git a/site/source/components/utils/persistState.ts b/site/source/components/utils/persistState.ts index d039ef01e..8b9cbbd79 100644 --- a/site/source/components/utils/persistState.ts +++ b/site/source/components/utils/persistState.ts @@ -24,8 +24,9 @@ export const useSafeLocaleStorage = (key: string, state: any) => { } export const usePersistingState = (key: string, defaultState?: any) => { - const initialState = getInitialState(key) - const state = initialState != null ? initialState : defaultState + const persistedState = getInitialState(key) + const initialState = persistedState != null ? persistedState : defaultState + const [state, setState] = useState(initialState) useSafeLocaleStorage(key, state) - return useState(state) + return [state, setState] }