diff --git a/src/components/purchase-orders/send-po-modal.tsx b/src/components/purchase-orders/send-po-modal.tsx index 14d817e..593f373 100644 --- a/src/components/purchase-orders/send-po-modal.tsx +++ b/src/components/purchase-orders/send-po-modal.tsx @@ -92,12 +92,12 @@ export function SendPoModal({ open, purchaseOrder, onClose, onSent }: Props) { setSubject(`Purchase Order ${po.po_number}`); setMessage(""); } - // Phase 2: async default-body seed. SKIPPED on the resend flow — the - // operator's previous bodyText is already prefilled in phase 1 above - // and we mustn't clobber it with the generic template once the fetch - // resolves. Phase 2 also gates messageLoading so the textarea doesn't - // grey out mid-edit on resend. - if (!isResendFlow) { + // Phase 2: async default-body seed. Skip only when the resend flow has a + // previous body to preserve so the generic template doesn't clobber it. + // If there is nothing to preserve (for example, a legacy sent PO without + // email_payload), fall back to the default body. Phase 2 also gates + // messageLoading so the textarea doesn't grey out mid-edit on resend. + if (!isResendFlow || !previous) { setMessageLoading(true); (async () => { try {