@devries-cameron20 / t3code-1 / commits / 9ef9274965
Fork 0

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

fix(web): stop crashing the native React Compiler on ChatView (#20340)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 17:39 UTC 9ef927496573c059f9f3b06d0faa4cee37e0e993
3 files changed +53 -20
apps/web/src/components/ChatView.logic.test.ts
+27
@@ -1,5 +1,6 @@
1 import {
2 findRecordedWorktreeSetup,
3 + isThreadWokeUnseen,
4 mergeDirectPreviewAnnotation,
5 resolveVisibleWorktreeSetup,
6 } from "./ChatView.logic";
@@ -2234,3 +2235,29 @@ describe("mergeDirectPreviewAnnotation", () => {
2235 expect(result.previewAnnotations).toBe(existing);
2236 });
2237 });
2238 +
2239 +describe("isThreadWokeUnseen", () => {
2240 + const base = {
2241 + wokeAt: "2026-10-16T10:00:00.000Z",
2242 + settled: false,
2243 + lastVisitedAt: null,
2244 + latestRunCompletedAt: null,
2245 + };
2246 +
2247 + it("shows a wake the user has not seen", () => {
2248 + expect(isThreadWokeUnseen({ ...base, lastVisitedAt: "2026-10-16T09:00:00.000Z" })).toBe(true);
2249 + expect(isThreadWokeUnseen(base)).toBe(true);
2250 + });
2251 +
2252 + it("hides a wake seen by a later visit or a later completed run", () => {
2253 + expect(isThreadWokeUnseen({ ...base, lastVisitedAt: "2026-10-16T11:00:00.000Z" })).toBe(false);
2254 + expect(isThreadWokeUnseen({ ...base, latestRunCompletedAt: "2026-10-16T11:00:00.000Z" })).toBe(
2255 + false,
2256 + );
2257 + });
2258 +
2259 + it("hides settled threads and unparseable wake times", () => {
2260 + expect(isThreadWokeUnseen({ ...base, settled: true })).toBe(false);
2261 + expect(isThreadWokeUnseen({ ...base, wokeAt: "not a date" })).toBe(false);
2262 + });
2263 +});
apps/web/src/components/ChatView.logic.ts
+19
@@ -1339,3 +1339,22 @@ export function mergeDirectPreviewAnnotation(input: {
1339 ];
1340 return { images, previewAnnotations };
1341 }
1342 +
1343 +/**
1344 + * Whether a woken thread woke after the user last saw it. A run that completed
1345 + * after the last visit counts as seeing it, since the user watched it finish.
1346 + */
1347 +export function isThreadWokeUnseen(input: {
1348 + readonly wokeAt: string | null;
1349 + readonly settled: boolean;
1350 + readonly lastVisitedAt: string | null | undefined;
1351 + readonly latestRunCompletedAt: string | null;
1352 +}): boolean {
1353 + if (input.wokeAt === null || input.settled) return false;
1354 + const wokeAtMs = Date.parse(input.wokeAt);
1355 + if (Number.isNaN(wokeAtMs)) return false;
1356 + const seenAt = [input.lastVisitedAt, input.latestRunCompletedAt]
1357 + .map((value) => (value ? Date.parse(value) : NaN))
1358 + .filter((ms) => !Number.isNaN(ms));
1359 + return seenAt.every((ms) => ms < wokeAtMs);
1360 +}
apps/web/src/components/ChatView.tsx
+7 -20
@@ -2,6 +2,7 @@ import { ThreadFind, ThreadFindCanvas, type ThreadFindControls } from "./chat/Th
2 import { THREAD_FIND_BAR_RESERVED_HEIGHT } from "./chat/ThreadFindBar";
3 import { usageLimitRecoveryBannerItem } from "./chat/UsageLimitRecoveryBanner";
4 import {
5 + isThreadWokeUnseen,
6 mergeDirectPreviewAnnotation,
7 resolveBackgroundDraftWorkspaceOptions,
8 resolveDraftHeroState,
@@ -5267,26 +5268,12 @@ export default function ChatView(props: ChatViewProps) {
5268 activeThreadShell?.lastVisitedAt,
5269 activeThreadLocalVisitedAt,
5270 );
5270 - const activeThreadWokeVisible = useMemo(() => {
5271 - if (activeThreadWokeAt === null) return false;
5272 - if (activeThreadShell?.settledOverride === "settled") return false;
5273 - const wokeAtMs = Date.parse(activeThreadWokeAt);
5274 - if (Number.isNaN(wokeAtMs)) return false;
5275 - const storedVisitMs = activeThreadLastVisitedAt ? Date.parse(activeThreadLastVisitedAt) : NaN;
5276 - const completedAtMs = activeLatestRun?.completedAt
5277 - ? Date.parse(activeLatestRun.completedAt)
5278 - : NaN;
5279 - const lastVisitedMs = Math.max(
5280 - Number.isNaN(storedVisitMs) ? -Infinity : storedVisitMs,
5281 - Number.isNaN(completedAtMs) ? -Infinity : completedAtMs,
5282 - );
5283 - return lastVisitedMs < wokeAtMs;
5284 - }, [
5285 - activeLatestRun?.completedAt,
5286 - activeThreadLastVisitedAt,
5287 - activeThreadShell,
5288 - activeThreadWokeAt,
5289 - ]);
5271 + const activeThreadWokeVisible = isThreadWokeUnseen({
5272 + wokeAt: activeThreadWokeAt,
5273 + settled: activeThreadShell?.settledOverride === "settled",
5274 + lastVisitedAt: activeThreadLastVisitedAt,
5275 + latestRunCompletedAt: activeLatestRun?.completedAt ?? null,
5276 + });
5277 const activeThreadSettled =
5278 supportsSettlement && activeThreadShell?.settledOverride === "settled";
5279 const unsettleThreadMutation = useOrchestrationCommand(threadEnvironment.unsettle, {