TypeScript
fix(mobile): show assistant quotes as text in the queue sheet (#19007)
Nishchay M Chandracbe43566f416
diff --git a/apps/mobile/src/features/threads/threadQueueControlPresentation.test.ts b/apps/mobile/src/features/threads/threadQueueControlPresentation.test.tsindex 93dbb7dd07d..093b077aab2 100644--- a/apps/mobile/src/features/threads/threadQueueControlPresentation.test.ts+++ b/apps/mobile/src/features/threads/threadQueueControlPresentation.test.ts@@ -1,3 +1,4 @@+import { formatAssistantCitationHref } from "@t3tools/shared/assistantCitations";import { describe, expect, it } from "vite-plus/test";import {@@ -10,6 +11,32 @@ import {import { threadDragGapOffset } from "./threadDragGap";describe("threadQueueControlPresentation", () => {+ it("shows an assistant quote as its quoted text", () => {+ const href = formatAssistantCitationHref({+ version: 1,+ environmentId: "environment:test" as never,+ threadId: "thread:test" as never,+ messageId: "message:assistant" as never,+ text: "Retry the sync after the lock clears.",+ start: 0,+ end: 37,+ prefix: "",+ suffix: "",+ });+ const controls = resolveThreadQueueRowControls({+ busy: false,+ canPromoteToSteer: true,+ canReorder: true,+ index: 0,+ queuedCount: 1,+ text: `[Assistant quote](${href}) Can we add a backoff here?`,+ });++ expect(controls.displayText).toBe(+ "Retry the sync after the lock clears. Can we add a backoff here?",+ );+ });+it("preserves queue reorder and steer controls with removal", () => {const controls = resolveThreadQueueRowControls({busy: false,diff --git a/apps/mobile/src/features/threads/threadQueueControlPresentation.ts b/apps/mobile/src/features/threads/threadQueueControlPresentation.tsindex b19b3620908..4128c874f94 100644--- a/apps/mobile/src/features/threads/threadQueueControlPresentation.ts+++ b/apps/mobile/src/features/threads/threadQueueControlPresentation.ts@@ -1,4 +1,5 @@import type { EnvironmentId, RunId, ThreadId } from "@t3tools/contracts";+import { assistantCitationsToPlainText } from "@t3tools/shared/assistantCitations";export const REMOVE_QUEUED_MESSAGE_ACCESSIBILITY_LABEL = "Remove queued message";@@ -34,7 +35,8 @@ export function resolveThreadQueueRowControls(input: {canMoveUp: mutationEnabled && input.canReorder && input.index > 0,canSteer: mutationEnabled && input.canPromoteToSteer && !isEditing,dismissAccessibilityLabel: REMOVE_QUEUED_MESSAGE_ACCESSIBILITY_LABEL,- displayText: input.text,+ // Edit and Steer keep the original text so quoted citations stay linked.+ displayText: assistantCitationsToPlainText(input.text),isEditing,};}