diff --git a/components/email/email-composer.tsx b/components/email/email-composer.tsx index addb4356..20400084 100644 --- a/components/email/email-composer.tsx +++ b/components/email/email-composer.tsx @@ -308,8 +308,14 @@ export function EmailComposer({ getIdentityReplySignatureId, } = useSignatureStore(); + // Lazy useState initializer (below) — runs during the FIRST render, before + // the selectedIdentityId state declared further down exists yet (same TDZ + // constraint the initialCurrentIdentityForSig comment a few lines down + // already documents). On that first render selectedIdentityId can only be + // unset anyway (nothing has called setSelectedIdentityId yet), so reading + // initialData directly is equivalent, not a workaround. const resolveStoreSignatureId = (): string | null => { - const perIdentityId = selectedIdentityId || initialData?.selectedIdentityId || null; + const perIdentityId = initialData?.selectedIdentityId || null; if (mode === 'compose') { if (perIdentityId) { const id = getIdentityDefaultSignatureId(perIdentityId);