From c670403b819b5fc6e257df591a5453180ba9f833 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Sat, 29 Aug 2026 01:14:43 +0200 Subject: [PATCH] fix(client): let an output diff supersede a create preview, and guard two edges A diff in the output now supersedes everything, including a create's authored content. `create_file` overwriting an existing file returns a summary plus a unified diff, and preferring the authored content there rendered that diff twice: once through DiffView and again verbatim as the raw output section. This restores the precedence the string-preview version had. Give image tiles distinct React keys. Syndicated images reuse one thumbnail across results that link to different pages, and grouped searches merge attachments, so the source alone collided. Require the composer to still hold the submitted text before restoring the stashed ask message. The textarea stays editable while the resume is in flight, so anything typed since is newer than both the stash and the answer. --- .../Content/Parts/FileAuthoringCall.tsx | 13 ++++++--- .../Chat/Messages/Content/verticals.tsx | 5 +++- client/src/hooks/Input/useAskAnswerMode.ts | 28 +++++++++---------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx b/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx index e821dad9c1..ca805c0b19 100644 --- a/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx @@ -135,14 +135,19 @@ export default function FileAuthoringCall({ } return !isCreate && editArgs.length > 0 ? buildEditPreviewDiff(editArgs) : null; }, [outputIsDiff, output, isCreate, editArgs]); - /** Plain text for the non-diff pane, and the copy payload either way. */ + /** Plain text for the non-diff pane, and the copy payload either way. A diff + * in the output supersedes everything, including a create's authored + * content: `create_file` overwriting an existing file returns a summary plus + * a unified diff, and preferring the authored content there rendered that + * diff twice, once through `DiffView` and again verbatim as the raw output + * section. */ const preview = useMemo(() => { - if (isCreate) { - return authoredContent || output; - } if (outputIsDiff) { return output; } + if (isCreate) { + return authoredContent || output; + } return parsedDiff ? diffPreviewText(parsedDiff) : output; }, [isCreate, authoredContent, outputIsDiff, output, parsedDiff]); const showOutputSection = !!output && preview !== output; diff --git a/client/src/components/Chat/Messages/Content/verticals.tsx b/client/src/components/Chat/Messages/Content/verticals.tsx index 83ba26c2e7..0eb318de59 100644 --- a/client/src/components/Chat/Messages/Content/verticals.tsx +++ b/client/src/components/Chat/Messages/Content/verticals.tsx @@ -119,7 +119,10 @@ function ImageStrip({ images, label }: { images: ImageResult[]; label: string }) ? `${image.thumbnailWidth} / ${image.thumbnailHeight}` : '1 / 1'; return ( -