From bbbfb4f90dddec2e39e49e4c672b5642be9ae516 Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Mon, 29 Dec 2025 03:42:15 +0400 Subject: [PATCH] fix: tab preview isolation + remove change log from canvas Tab Preview Isolation: - LiveCanvas now uses activeTab.previewData directly - All canvas UI elements use activeTab state - Each tab shows its own preview, not shared state Change Log Removal: - Strip change log text from preview data before rendering - Pattern matches [/type:lang] Change Log: and **Change Log:** - Change log stays in chat, never rendered in canvas - Guards against false positives (app content > 500 chars) --- components/AIAssist.tsx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/components/AIAssist.tsx b/components/AIAssist.tsx index 6c12c4b..62f2428 100644 --- a/components/AIAssist.tsx +++ b/components/AIAssist.tsx @@ -386,6 +386,17 @@ function parseStreamingContent(text: string, currentAgent: string) { if (isHtmlLike) { preview.data = decodeHtml(stripFences(preview.data)); } + + // CRITICAL: Strip any change log that leaked into preview data + // The change log should be in chat, not rendered in canvas + preview.data = preview.data + .replace(/\[\/[a-z]+:[a-z]+\]\s*\*?\*?Change\s*Log:?\*?\*?[\s\S]*$/i, '') + .replace(/\*?\*?Change\s*Log:?\*?\*?[\s\S]*$/i, function (match) { + // Only strip if it's at the end and looks like a change log section + if (match.length > 500) return match; // Probably part of the app, not a log + return ''; + }) + .trim(); } if (!preview && !text.includes("[PREVIEW")) { @@ -1022,18 +1033,18 @@ export default function AIAssist() {
- {viewMode === "preview" && previewData ? ( + {viewMode === "preview" && activeTab?.previewData ? ( ) : (
-                                            {previewData?.data}
+                                            {activeTab?.previewData?.data}
                                         
)} @@ -1041,13 +1052,13 @@ export default function AIAssist() {
-
+
- {previewData?.isStreaming ? "Neural Link Active" : "Sync Complete"} + {activeTab?.previewData?.isStreaming ? "Neural Link Active" : "Sync Complete"}
- {previewData?.language?.toUpperCase()} UTF-8 + {activeTab?.previewData?.language?.toUpperCase()} UTF-8