From c8d8deb2cc887f084ba1c5ade0c65078b7e58ab2 Mon Sep 17 00:00:00 2001 From: Mark Henderson Date: Mon, 2 Mar 2026 19:57:59 -0800 Subject: [PATCH] Fix AtlasChat crash: guard renderContent and message render against null content Made-with: Cursor --- components/AtlasChat.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/AtlasChat.tsx b/components/AtlasChat.tsx index a4f9af9..a48ae58 100644 --- a/components/AtlasChat.tsx +++ b/components/AtlasChat.tsx @@ -16,7 +16,8 @@ interface AtlasChatProps { // --------------------------------------------------------------------------- // Markdown-lite renderer — handles **bold**, newlines, numbered/bullet lists // --------------------------------------------------------------------------- -function renderContent(text: string) { +function renderContent(text: string | null | undefined) { + if (!text) return null; return text.split("\n").map((line, i) => { const parts = line.split(/(\*\*.*?\*\*)/g).map((seg, j) => seg.startsWith("**") && seg.endsWith("**") @@ -205,7 +206,8 @@ export function AtlasChat({ projectId }: AtlasChatProps) { } }; - const isEmpty = messages.length === 0 && !isStreaming; + const visibleMessages = messages.filter(msg => msg.content); + const isEmpty = visibleMessages.length === 0 && !isStreaming; return (
Reset - {messages.map((msg, i) => ( + {visibleMessages.map((msg, i) => ( ))} {isStreaming && }