@devries-cameron20 / t3code Mirror · read-only / commits / 24c617d32e
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 25, 17:15 UTC

Fix broad query invalidation on checkpoint/captured events

Scope invalidation to only the checkpoint diff query for the newly captured turn instead of invalidating all provider queries. The checkpoint/captured event carries a turnCount in its payload, so we use a predicate to match only the query whose toTurnCount equals the captured turn. This prevents N unnecessary refetches of immutable diffs for already-completed turns on each new turn completion.

Cursor Agent committed Feb 19, 2026 at 00:37 UTC 24c617d32ef64e4aeceedb4746ef89c3815360c0
1 file changed +9 -2
apps/web/src/routes/__root.tsx
+9 -2
@@ -6,7 +6,6 @@ import { AnchoredToastProvider, ToastProvider } from "../components/ui/toast";
6 import { isElectron } from "../env";
7 import { useNativeApi } from "../hooks/useNativeApi";
8 import { invalidateGitQueries } from "../lib/gitReactQuery";
9 -import { providerQueryKeys } from "../lib/providerReactQuery";
9 import { DEFAULT_MODEL } from "../model-logic";
10 import { useStore } from "../store";
11 import { onServerWelcome } from "../wsNativeApi";
@@ -59,7 +58,15 @@ function EventRouter() {
58 void invalidateGitQueries(queryClient);
59 }
60 if (event.method === "checkpoint/captured") {
62 - void queryClient.invalidateQueries({ queryKey: providerQueryKeys.all });
61 + const payload = event.payload as { turnCount?: number } | undefined;
62 + const turnCount = payload?.turnCount;
63 + void queryClient.invalidateQueries({
64 + queryKey: ["providers", "checkpointDiff"] as const,
65 + predicate: (query) => {
66 + if (typeof turnCount !== "number") return true;
67 + return query.queryKey[5] === turnCount;
68 + },
69 + });
70 }
71 if (!activeThreadId) return;
72 dispatch({