@devries-cameron20 / t3code-1 / commits / d0f9d4dcc0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): sidebar draft previews show cited assistant text, not the raw link (#35406)

Julius Marminge committed Nov 12, 2026 at 09:37 UTC d0f9d4dcc01ba89f28c5cc3d948829dff6fcf6e5
2 files changed +21 -2
apps/web/src/components/sidebar/SidebarDraftBlock.browser.test.tsx
+17 -1
@@ -1,9 +1,10 @@
1 import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";
2 -import { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts";
2 +import { EnvironmentId, MessageId, ProjectId, ThreadId } from "@t3tools/contracts";
3 import { Profiler } from "react";
4 import { expect, it, vi } from "vite-plus/test";
5
6 import { act, render } from "../../../test/render";
7 +import { formatAssistantCitationForComposer } from "../../composer-logic";
8 import { DraftId, useComposerDraftStore } from "../../composerDraftStore";
9 import { SidebarDraftBlock } from "./SidebarDraftBlock";
10
@@ -53,6 +54,21 @@ it("keeps draft previews current through edits, promotion and removal", async ()
54 await act(() => initial.setPrompt(draftId, "Updated draft preview"));
55 await expect.element(row).toHaveAccessibleName("Updated draft preview, Unsent draft");
56
57 + const quote = "Cache the parsed config per worktree.";
58 + const citation = formatAssistantCitationForComposer({
59 + version: 1,
60 + environmentId,
61 + threadId: ThreadId.make("source-thread"),
62 + messageId: MessageId.make("source-message"),
63 + text: quote,
64 + start: 0,
65 + end: quote.length,
66 + prefix: "",
67 + suffix: "",
68 + });
69 + await act(() => initial.setPrompt(draftId, `${citation}Why per worktree?`));
70 + await expect.element(row).toHaveAccessibleName(`${quote} Why per worktree?, Unsent draft`);
71 +
72 await act(() => initial.markDraftThreadPromoting(draftId));
73 await expect.element(row).not.toBeInTheDocument();
74 await act(() => initial.clearDraftThread(draftId));
apps/web/src/components/sidebar/SidebarDraftBlock.tsx
+4 -1
@@ -1,4 +1,5 @@
1 import { discardComposerDraft } from "../../lib/discardComposerDraft";
2 +import { assistantCitationsToPlainText } from "@t3tools/shared/assistantCitations";
3 import { replaceComposerContextReferences } from "@t3tools/shared/composerContextReferences";
4 import { SquarePenIcon, XIcon } from "lucide-react";
5 import {
@@ -34,7 +35,9 @@ const SidebarDraftRow = memo(function SidebarDraftRow(props: {
35 }) {
36 const { composer, draftId, onContextMenu, onDiscard, onNavigate } = props;
37 const promptPreview =
37 - replaceComposerContextReferences(composer.prompt, (occurrence) => occurrence.label)
38 + assistantCitationsToPlainText(
39 + replaceComposerContextReferences(composer.prompt, (occurrence) => occurrence.label),
40 + )
41 .trim()
42 .split("\n", 1)[0] ?? "";
43 // images mirrors persistedAttachments once rehydration finishes; before