From 1e7fcfbbad7374ecf1cb6cfa3a18477ee9c859eb Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Fri, 27 Oct 2023 18:07:58 +0300 Subject: [PATCH] TW-1127 Use useDidUpdate --- src/lib/temple/front/storage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/temple/front/storage.ts b/src/lib/temple/front/storage.ts index 15e49ff00b..17a6d36963 100644 --- a/src/lib/temple/front/storage.ts +++ b/src/lib/temple/front/storage.ts @@ -4,6 +4,7 @@ import browser, { Storage } from 'webextension-polyfill'; import { fetchFromStorage, putToStorage } from 'lib/storage'; import { useRetryableSWR } from 'lib/swr'; +import { useDidUpdate } from 'lib/ui/hooks'; export function useStorage(key: string): [T | null | undefined, (val: SetStateAction) => Promise]; export function useStorage(key: string, fallback: T): [T, (val: SetStateAction) => Promise]; @@ -43,7 +44,7 @@ export function usePassiveStorage(key: string, fallback?: T) { const [value, setValue] = useState(finalData); - useEffect(() => { + useDidUpdate(() => { setValue(finalData); }, [finalData]);