fix: ensure draft editing function is called correctly in EmailViewer component #60
This commit is contained in:
@@ -519,7 +519,10 @@ export default function Home() {
|
|||||||
|
|
||||||
const handleEditDraft = async (email?: Email) => {
|
const handleEditDraft = async (email?: Email) => {
|
||||||
if (!client) return;
|
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;
|
if (!draft) return;
|
||||||
|
|
||||||
// The email list only fetches limited properties (no bodyValues/htmlBody/bcc).
|
// The email list only fetches limited properties (no bodyValues/htmlBody/bcc).
|
||||||
|
|||||||
@@ -2805,7 +2805,7 @@ export function EmailViewer({
|
|||||||
<Button
|
<Button
|
||||||
variant="default"
|
variant="default"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={onEditDraft}
|
onClick={() => onEditDraft()}
|
||||||
className="sm:flex sm:flex-row sm:h-8 sm:gap-1.5 sm:py-0"
|
className="sm:flex sm:flex-row sm:h-8 sm:gap-1.5 sm:py-0"
|
||||||
title={t('tooltips.edit_draft')}
|
title={t('tooltips.edit_draft')}
|
||||||
>
|
>
|
||||||
@@ -4403,7 +4403,7 @@ export function EmailViewer({
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={onEditDraft}
|
onClick={() => onEditDraft()}
|
||||||
className="gap-1.5"
|
className="gap-1.5"
|
||||||
>
|
>
|
||||||
<EditIcon className="w-3.5 h-3.5" />
|
<EditIcon className="w-3.5 h-3.5" />
|
||||||
@@ -4672,7 +4672,7 @@ export function EmailViewer({
|
|||||||
</button>
|
</button>
|
||||||
{isDraft && onEditDraft ? (
|
{isDraft && onEditDraft ? (
|
||||||
<button
|
<button
|
||||||
onClick={onEditDraft}
|
onClick={() => onEditDraft()}
|
||||||
className="flex flex-col items-center justify-center gap-1 py-2 px-3 min-w-[64px] min-h-[44px] shrink-0 text-primary active:text-primary/80 transition-colors duration-150"
|
className="flex flex-col items-center justify-center gap-1 py-2 px-3 min-w-[64px] min-h-[44px] shrink-0 text-primary active:text-primary/80 transition-colors duration-150"
|
||||||
aria-label={t('tooltips.edit_draft')}
|
aria-label={t('tooltips.edit_draft')}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user