Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix: diff panel unclosable after retainSearchParams middleware (#937)

eggfriedricea33cc8c75874
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 76a5610ce..4fb0bfb86 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -1003,7 +1003,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
replace: true,
search: (previous) => {
const rest = stripDiffSearchParams(previous);
- return diffOpen ? rest : { ...rest, diff: "1" };
+ return diffOpen ? { ...rest, diff: undefined } : { ...rest, diff: "1" };
},
});
}, [diffOpen, navigate, threadId]);
diff --git a/apps/web/src/diffRouteSearch.ts b/apps/web/src/diffRouteSearch.ts
index f310b74b7..d7de23e34 100644
--- a/apps/web/src/diffRouteSearch.ts
+++ b/apps/web/src/diffRouteSearch.ts
@@ -1,9 +1,9 @@
import { TurnId } from "@t3tools/contracts";
export interface DiffRouteSearch {
- diff?: "1";
- diffTurnId?: TurnId;
- diffFilePath?: string;
+ diff?: "1" | undefined;
+ diffTurnId?: TurnId | undefined;
+ diffFilePath?: string | undefined;
}
function isDiffOpenValue(value: unknown): boolean {
diff --git a/apps/web/src/routes/_chat.$threadId.tsx b/apps/web/src/routes/_chat.$threadId.tsx
index b85aeab0d..5e05b51fb 100644
--- a/apps/web/src/routes/_chat.$threadId.tsx
+++ b/apps/web/src/routes/_chat.$threadId.tsx
@@ -170,9 +170,7 @@ function ChatThreadRouteView() {
void navigate({
to: "/$threadId",
params: { threadId },
- search: (previous) => {
- return stripDiffSearchParams(previous);
- },
+ search: { diff: undefined },
});
}, [navigate, threadId]);
const openDiff = useCallback(() => {