diff --git a/src/app/(app)/collection-confirm/page.tsx b/src/app/(app)/collection-confirm/page.tsx index 0960416..2ad804c 100644 --- a/src/app/(app)/collection-confirm/page.tsx +++ b/src/app/(app)/collection-confirm/page.tsx @@ -9,6 +9,7 @@ import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { ModalShell } from "@/components/ui/modal-shell"; import { getPocketBase } from "@/lib/pocketbase"; +import { getClientIdentity } from "@/lib/dev-identity"; import { cn } from "@/lib/utils"; import { @@ -150,16 +151,17 @@ export default function CollectionConfirmPage() { useEffect(() => { if (typeof window === "undefined") return; - const cached = window.localStorage?.getItem("wfdash.actor"); - if (cached) { - try { - const parsed = JSON.parse(cached) as ConfirmActor; - // eslint-disable-next-line react-hooks/set-state-in-effect -- hydrate actor from localStorage on mount - if (parsed?.id) setActor(parsed); - } catch { - /* ignore */ - } - } + // The dev-identity switcher writes the active email to the + // `wfdash_dev_email` cookie. The earlier localStorage-based + // hydration never matched because nothing wrote to localStorage. + // getClientIdentity() returns the cookie value or the default + // (DEFAULT_DEV_EMAIL) when unset, so the actor is never empty + // for a signed-in operator. + const email = getClientIdentity(); + if (!email) return; + const name = email.split("@")[0] || email; + // eslint-disable-next-line react-hooks/set-state-in-effect -- hydrate actor from dev-identity cookie on mount + setActor({ id: email, name }); }, []); const persistRow = useCallback(