From 30747e7462b14ddff078d9db832d5a6e6f734d0d Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Thu, 14 Nov 2019 19:51:09 +0100 Subject: [PATCH] =?UTF-8?q?:bug:=20r=C3=A9pare=20page=20blanche=20sur=20le?= =?UTF-8?q?=20clic=20du=20logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/utils/persistState.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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] }