@devries-cameron20 / t3code-1 / commits / 31caa5652b
Fork 0

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

Fix reopening existing Diff tab (#3973)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Jake Leventhal committed Jul 18, 2026 at 07:18 UTC 31caa5652b0d3d68660c914a85af5101c057f6a0
2 files changed +26 -1
apps/web/src/components/ChatView.tsx
+11 -1
@@ -2916,9 +2916,19 @@ function ChatViewContent(props: ChatViewProps) {
2916 }, [activeThreadRef, openPreview]);
2917 const addDiffSurface = useCallback(() => {
2918 if (!activeThreadRef || !isServerThread || !isGitRepo) return;
2919 + if (planSidebarOpen) {
2920 + dismissPlanSidebarForCurrentTurn();
2921 + }
2922 useRightPanelStore.getState().open(activeThreadRef, "diff");
2923 onDiffPanelOpen?.();
2921 - }, [activeThreadRef, isGitRepo, isServerThread, onDiffPanelOpen]);
2924 + }, [
2925 + activeThreadRef,
2926 + dismissPlanSidebarForCurrentTurn,
2927 + isGitRepo,
2928 + isServerThread,
2929 + onDiffPanelOpen,
2930 + planSidebarOpen,
2931 + ]);
2932 const addFilesSurface = useCallback(() => {
2933 if (!activeThreadRef || !activeProject) return;
2934 useRightPanelStore.getState().open(activeThreadRef, "files");
apps/web/src/rightPanelStore.test.ts
+15
@@ -117,6 +117,21 @@ describe("rightPanelStore", () => {
117 ).toHaveLength(2);
118 });
119
120 + it("reopening an inactive singleton activates its existing surface", () => {
121 + useRightPanelStore.getState().open(refA, "diff");
122 + useRightPanelStore.getState().open(refA, "plan");
123 + useRightPanelStore.getState().open(refA, "diff");
124 +
125 + expect(selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA)).toEqual({
126 + isOpen: true,
127 + activeSurfaceId: "diff",
128 + surfaces: [
129 + { id: "diff", kind: "diff" },
130 + { id: "plan", kind: "plan" },
131 + ],
132 + });
133 + });
134 +
135 it("keeps files as a singleton surface", () => {
136 useRightPanelStore.getState().open(refA, "files");
137 useRightPanelStore.getState().open(refA, "files");