🐛 Répare la persistence du formulaire DLA

pull/1783/head
Johan Girod 2021-10-12 15:14:19 +02:00
parent c9536d4e77
commit 2887306702
1 changed files with 4 additions and 3 deletions

View File

@ -24,8 +24,9 @@ export const useSafeLocaleStorage = (key: string, state: any) => {
}
export const usePersistingState = <S>(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<S>(initialState)
useSafeLocaleStorage(key, state)
return useState<S>(state)
return [state, setState]
}