From ce85fd61887bc1f5abe39044fd6eaa2ba85f1585 Mon Sep 17 00:00:00 2001 From: Matthew Meszaros Date: Fri, 4 Sep 2026 03:27:20 -0700 Subject: [PATCH] feat: clear the rendered step preview alongside the contact and mailbox picks when the editor changes campaign, so the panel cannot keep showing the previous campaign's sender and attachments while the new render is in flight --- .../app/campaigns/sequences/EmailContentEditor.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/components/app/campaigns/sequences/EmailContentEditor.tsx b/web/src/components/app/campaigns/sequences/EmailContentEditor.tsx index 1a6f102d..3e64cc0f 100644 --- a/web/src/components/app/campaigns/sequences/EmailContentEditor.tsx +++ b/web/src/components/app/campaigns/sequences/EmailContentEditor.tsx @@ -72,12 +72,15 @@ export default function EmailContentEditor({ // to the campaign's first enabled sender once the pool has loaded. const [previewContact, setPreviewContact] = React.useState(null); const [previewMailbox, setPreviewMailbox] = React.useState(null); + const [serverPreview, setServerPreview] = React.useState(null); const senders = useCampaignSenderInboxes(campaignId ?? ""); // Both picks belong to one campaign, so drop them when this editor is - // pointed at a different one, or at none, without remounting. + // pointed at a different one, or at none, without remounting. The rendered + // panel goes with them: it names a sender and files of the old campaign. React.useEffect(() => { setPreviewContact(null); setPreviewMailbox(null); + setServerPreview(null); }, [campaignId]); React.useEffect(() => { if (!campaignId) return; @@ -88,7 +91,6 @@ export default function EmailContentEditor({ const previewMut = useTemplatePreview(); const runPreview = previewMut.mutateAsync; - const [serverPreview, setServerPreview] = React.useState(null); React.useEffect(() => { if (tab !== "preview") return; // Responses can land out of order; only the newest request may paint.