From 288730670227e3a05f4da2c2753d72077f6f6619 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Tue, 12 Oct 2021 15:14:19 +0200 Subject: [PATCH] =?UTF-8?q?:bug:=20R=C3=A9pare=20la=20persistence=20du=20f?= =?UTF-8?q?ormulaire=20DLA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/source/components/utils/persistState.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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] }