@devries-cameron20 / t3code-1 / commits / 3fc8e5d655
Fork 0

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

fix(web): reopening the Changes panel refreshes its diff (#19550)

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

Ali Younes committed Oct 20, 2026 at 00:10 UTC 3fc8e5d65534ca450877176b82ec63dfb1ce29e9
2 files changed +35 -7
apps/web/src/components/DiffPanel.tsx
+34 -7
@@ -188,12 +188,14 @@ interface DiffPanelProps {
188 mode?: DiffPanelMode;
189 composerDraftTarget: ScopedThreadRef | DraftId;
190 workspaceMutationId: string | null;
191 + visible: boolean;
192 }
193
194 export default function DiffPanel({
195 mode = "inline",
196 composerDraftTarget,
197 workspaceMutationId,
198 + visible,
199 }: DiffPanelProps) {
200 const { resolvedTheme } = useTheme();
201 const settings = useClientSettings((settings) => ({
@@ -466,6 +468,38 @@ export default function DiffPanel({
468 preview: renderablePatch,
469 });
470 const refreshBranchDiffPreview = refreshPreviewQuery;
471 + const previewOpenHandledRef = useRef(false);
472 + const refreshDiffForWorkspaceMutation = useStableCallback(() => {
473 + previewOpenHandledRef.current = true;
474 + refreshBranchDiffPreview();
475 + });
476 +
477 + // A mutation refresh also satisfies revalidation for the current opening.
478 + useWorkspaceMutationRefresh({
479 + enabled: canRefreshGitDiff,
480 + mutationId: workspaceMutationId,
481 + refresh: refreshDiffForWorkspaceMutation,
482 + resourceKey: `diff:${activeThreadRefreshKey ?? ""}`,
483 + });
484 +
485 + useEffect(() => {
486 + if (!visible || !canReadFiles || !canRefreshGitDiff) {
487 + previewOpenHandledRef.current = false;
488 + return;
489 + }
490 + if (previewOpenHandledRef.current) return;
491 + previewOpenHandledRef.current = true;
492 + if (branchDiffPreview.data !== null && !branchDiffPreview.isPending) {
493 + refreshBranchDiffPreview();
494 + }
495 + }, [
496 + branchDiffPreview.data,
497 + branchDiffPreview.isPending,
498 + canReadFiles,
499 + canRefreshGitDiff,
500 + refreshBranchDiffPreview,
501 + visible,
502 + ]);
503
504 useEffect(() => {
505 if (!canRefreshGitDiff) return;
@@ -474,13 +508,6 @@ export default function DiffPanel({
508 return () => window.removeEventListener("focus", refreshOnFocus);
509 }, [canRefreshGitDiff, refreshBranchDiffPreview]);
510
477 - useWorkspaceMutationRefresh({
478 - enabled: canRefreshGitDiff,
479 - mutationId: workspaceMutationId,
480 - refresh: refreshBranchDiffPreview,
481 - resourceKey: `diff:${activeThreadRefreshKey ?? ""}`,
482 - });
483 -
511 const isRefreshingDiff = branchDiffPreview.isPending || areFilePatchesPending;
512 const renderableFileEntries = renderableFiles.map(getCachedFileEntry);
513 const diffFileKeys = renderableFileEntries.map((file) => file.fileKey);
apps/web/src/components/chat/RightPanelSurfaceContent.tsx
+1
@@ -111,6 +111,7 @@ export function RightPanelSurfaceContent(props: {
111 mode="embedded"
112 composerDraftTarget={props.composerDraftTarget}
113 workspaceMutationId={props.workspaceMutationId}
114 + visible={visible}
115 />
116 </Suspense>
117 );