Skip to content

Commit 3db2e12

Browse files
BunsDevclaude
andcommitted
fix: collapse long proposed plans by truncating DOM content
The collapsed state rendered the full plan markdown in the DOM and relied on CSS overflow-hidden to clip it visually. This caused the browser test to correctly detect hidden text still present in document.body.textContent. Compute markdownPreview whenever the plan is collapsible (not only when a checklist is present) so the collapsed state renders a truncated preview instead of the full content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 88f75d3 commit 3db2e12

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

apps/web/src/components/chat/ProposedPlanCard.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ export const ProposedPlanCard = memo(function ProposedPlanCard({
5858

5959
const hasChecklist = checklistItems.length > 0;
6060

61-
// Build a preview for the markdown section (only used when checklist is present).
62-
const markdownPreview = useMemo(() => {
63-
if (!hasChecklist) return null;
64-
return buildCollapsedProposedPlanPreviewMarkdown(planMarkdown, { maxLines: 6 });
65-
}, [planMarkdown, hasChecklist]);
66-
6761
// When no checklist items are found, fall back to the original markdown-only view.
6862
const lineCount = planMarkdown.split("\n").length;
6963
const canCollapseMarkdown = planMarkdown.length > 900 || lineCount > 20;
7064

65+
// Build a truncated preview so collapsed plans never leak hidden content into the DOM.
66+
const markdownPreview = useMemo(() => {
67+
if (!canCollapseMarkdown) return null;
68+
return buildCollapsedProposedPlanPreviewMarkdown(planMarkdown, { maxLines: 6 });
69+
}, [planMarkdown, canCollapseMarkdown]);
70+
7171
const handleDownload = () => {
7272
downloadPlanAsTextFile(downloadFilename, saveContents);
7373
};

0 commit comments

Comments
 (0)