@devries-cameron20 / t3code Mirror · read-only / commits / 330b9f4840
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 22:15 UTC

fix(web): arrow keys and buttons step through the images an agent viewed (#34333)

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>

Theo Browne committed Nov 11, 2026 at 13:34 UTC 330b9f484032e7a7f9df01c5d73accd97ec356b8
2 files changed +46 -6
apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
+45 -5
@@ -44,7 +44,9 @@ import {
44 deriveTimelineEntriesFromVisibleTurnItems,
45 } from "../../session-logic";
46 import type { Root } from "mdast";
47 +import { ViewedImagesTimelineRow } from "./TimelineWorkEntryRow";
48 import { remarkThoughtPreview, THOUGHT_PREVIEW_MAX_LENGTH } from "./TimelineWorkEntryRow.logic";
49 +import { TimelineRowCtx } from "./timelineRowContext";
50 import { parseMarkdownWithMath } from "@t3tools/shared/markdownMath";
51 import { collectThreadFindRanges } from "./threadFindHighlights";
52 import { toastManager } from "../ui/toast";
@@ -74,14 +76,14 @@ vi.mock(import("~/state/query"), async (original) => ({
76 })) as never,
77 }));
78
77 -const audioAsset = vi.hoisted(() => ({ url: "" }));
79 +const stubbedAsset = vi.hoisted(() => ({ url: "" }));
80 vi.mock(import("~/assets/assetUrls"), async (original) => {
81 const actual = await original();
82 return {
83 ...actual,
84 useAssetUrlState: ((...args: Parameters<typeof actual.useAssetUrlState>) =>
83 - audioAsset.url
84 - ? { _tag: "Success", url: audioAsset.url }
85 + stubbedAsset.url
86 + ? { _tag: "Success", url: stubbedAsset.url }
87 : actual.useAssetUrlState(...args)) as typeof actual.useAssetUrlState,
88 };
89 });
@@ -1457,9 +1459,9 @@ describe("MessagesTimeline attachments", () => {
1459 );
1460 const src =
1461 "data:audio/wav;base64,UklGRiUAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQEAAACA";
1460 - audioAsset.url = src;
1462 + stubbedAsset.url = src;
1463 onTestFinished(() => {
1462 - audioAsset.url = "";
1464 + stubbedAsset.url = "";
1465 });
1466 const props = baseProps();
1467 await using screen = await renderTimeline(
@@ -1527,6 +1529,44 @@ describe("MessagesTimeline attachments", () => {
1529 });
1530 await vi.waitFor(() => expect(one!.isConnected).toBe(false));
1531 });
1532 +
1533 + it("opens a viewed image as a gallery of the images beside it", async () => {
1534 + stubbedAsset.url =
1535 + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
1536 + onTestFinished(() => {
1537 + stubbedAsset.url = "";
1538 + });
1539 + const onImageExpand = vi.fn<ComponentProps<typeof MessagesTimeline>["onImageExpand"]>();
1540 + await using screen = await renderElement(
1541 + <TimelineRowCtx
1542 + value={
1543 + {
1544 + threadRef: { environmentId: ENVIRONMENT_ID, threadId: ThreadId.make("thread-1") },
1545 + workspaceRoot: "/repo",
1546 + onImageExpand,
1547 + } as never
1548 + }
1549 + >
1550 + <ViewedImagesTimelineRow
1551 + row={{
1552 + kind: "viewed-images",
1553 + id: "viewed",
1554 + createdAt: CREATED_AT,
1555 + paths: ["/repo/first.png", "/repo/second.png", "/repo/third.png"],
1556 + }}
1557 + />
1558 + </TimelineRowCtx>,
1559 + );
1560 + await screen.getByRole("button", { name: "Preview second.png" }).click();
1561 + expect(onImageExpand).toHaveBeenCalledExactlyOnceWith(
1562 + expect.objectContaining({
1563 + index: 1,
1564 + images: ["first.png", "second.png", "third.png"].map((name) =>
1565 + expect.objectContaining({ name }),
1566 + ),
1567 + }),
1568 + );
1569 + });
1570 });
1571
1572 describe("MessagesTimeline thread find", () => {
apps/web/src/components/chat/TimelineWorkEntryRow.tsx
+1 -1
@@ -182,7 +182,7 @@ export function ViewedImagesTimelineRow({
182 const { threadRef, workspaceRoot, onImageExpand } = use(TimelineRowCtx);
183 if (!threadRef) return null;
184 return (
185 - <div className="flex flex-wrap items-start gap-2 px-0.5">
185 + <div className="flex flex-wrap items-start gap-2 px-0.5" data-image-gallery>
186 {row.paths.map((path) => {
187 const image = resolveViewedImageAsset(path, {
188 threadId: threadRef.threadId,