diff --git a/source/components/utils/persistState.ts b/source/components/utils/persistState.ts index f1e49ebe8..084c2c7c0 100644 --- a/source/components/utils/persistState.ts +++ b/source/components/utils/persistState.ts @@ -2,7 +2,10 @@ import { useEffect, useState } from 'react' import safeLocalStorage from '../../storage/safeLocalStorage' export const persistState = (key: string) => ([state, changeState]) => { - useEffect(() => safeLocalStorage.setItem(key, JSON.stringify(state)), [state]) + useEffect(() => { + safeLocalStorage.setItem(key, JSON.stringify(state)) + return + }, [state]) return [state, changeState] }