From 2d9c0edbd481920dc71b53a7048a596ee1bc25c3 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 11 Aug 2025 14:27:49 -0500 Subject: [PATCH] Moar debug --- src/storage/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/storage/index.ts b/src/storage/index.ts index d503167ae7..f4d81c59ea 100644 --- a/src/storage/index.ts +++ b/src/storage/index.ts @@ -113,14 +113,21 @@ export function useStorage< ] { type Schema = StorageSchema const initialized = useRef(false) - const [value, setValue] = useState(() => - storage.get(scopes), - ) + const [value, setValue] = useState(() => { + if (debug) logger.debug(`${debug} - init`, { + value: storage.get(scopes) ?? 'unset' + }) + return storage.get(scopes) + }) useEffect(() => { if (!initialized.current) { const raw = storage.get(scopes) if (value !== raw) { + logger.debug(`${debug} - syncing initial`, { + value: value ?? 'unset', + raw: raw ?? 'unset', + }) initialized.current = true setValue(raw) }