Skip to content
TypeScript

fix(web): expired terminal context toasts say "them" for several contexts (#24251)

MarcoDotIOcd7791de1eb2
diff --git a/apps/web/src/components/ChatView.logic.test.ts b/apps/web/src/components/ChatView.logic.test.ts
index 3304899216f..14125c68404 100644
--- a/apps/web/src/components/ChatView.logic.test.ts
+++ b/apps/web/src/components/ChatView.logic.test.ts
@@ -1,5 +1,6 @@
import {
boundAttachmentIds,
+ buildExpiredTerminalContextToastCopy,
mergeDirectPreviewAnnotation,
planComposerTurn,
snapshotComposerSend,
@@ -127,6 +128,22 @@ describe("deriveComposerSendState", () => {
});
});
+describe("buildExpiredTerminalContextToastCopy", () => {
+ it("refers to several expired contexts as them", () => {
+ expect(buildExpiredTerminalContextToastCopy(2, "empty")).toEqual({
+ title: "Expired terminal contexts won't be sent",
+ description: "Remove them or re-add them to include terminal output.",
+ });
+ expect(buildExpiredTerminalContextToastCopy(2, "omitted")).toEqual({
+ title: "Expired terminal contexts omitted from message",
+ description: "Re-add them if you want that terminal output included.",
+ });
+ expect(buildExpiredTerminalContextToastCopy(1, "omitted").description).toBe(
+ "Re-add it if you want that terminal output included.",
+ );
+ });
+});
+
describe("hasServerAcknowledgedLocalDispatch", () => {
it("acknowledges a settled newer background turn", () => {
const localDispatch = createLocalDispatchSnapshot(
diff --git a/apps/web/src/components/ChatView.logic.ts b/apps/web/src/components/ChatView.logic.ts
index 2ba094c23e1..49fe3a441fb 100644
--- a/apps/web/src/components/ChatView.logic.ts
+++ b/apps/web/src/components/ChatView.logic.ts
@@ -782,15 +782,16 @@ export function buildExpiredTerminalContextToastCopy(
): { title: string; description: string } {
const count = Math.max(1, Math.floor(expiredTerminalContextCount));
const noun = count === 1 ? "Expired terminal context" : "Expired terminal contexts";
+ const pronoun = count === 1 ? "it" : "them";
if (variant === "empty") {
return {
title: `${noun} won't be sent`,
- description: "Remove it or re-add it to include terminal output.",
+ description: `Remove ${pronoun} or re-add ${pronoun} to include terminal output.`,
};
}
return {
title: `${noun} omitted from message`,
- description: "Re-add it if you want that terminal output included.",
+ description: `Re-add ${pronoun} if you want that terminal output included.`,
};
}