From 574bd7ecefe8b8a85b376a32ef7eeb03eaa40dd2 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 28 Mar 2026 00:52:28 +0100 Subject: [PATCH] fix: ensure draft editing function is called correctly in EmailViewer component #60 --- app/[locale]/page.tsx | 5 ++++- components/email/email-viewer.tsx | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index 9cb62eb9..3d4b0273 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -519,7 +519,10 @@ export default function Home() { const handleEditDraft = async (email?: Email) => { if (!client) return; - let draft = email || selectedEmail; + const draftCandidate = email && typeof email === 'object' && typeof email.id === 'string' + ? email + : selectedEmail; + let draft = draftCandidate; if (!draft) return; // The email list only fetches limited properties (no bodyValues/htmlBody/bcc). diff --git a/components/email/email-viewer.tsx b/components/email/email-viewer.tsx index 2e5f585a..1081b51a 100644 --- a/components/email/email-viewer.tsx +++ b/components/email/email-viewer.tsx @@ -2805,7 +2805,7 @@ export function EmailViewer({ {isDraft && onEditDraft ? (