Fix visible changes pane diff subscription

This commit is contained in:
Mohamed Boudra
2026-04-30 10:38:07 +07:00
parent bdb8f6f535
commit 0aa7c768ba
3 changed files with 14 additions and 12 deletions
@@ -483,6 +483,7 @@ function SidebarContent({
workspaceId={workspaceId}
cwd={workspaceRoot}
hideHeaderRow={!isMobile}
enabled={isOpen}
/>
)}
{resolvedTab === "files" && (
+13 -2
View File
@@ -746,6 +746,7 @@ interface GitDiffPaneProps {
workspaceId?: string | null;
cwd: string;
hideHeaderRow?: boolean;
enabled?: boolean;
}
type PressableStyleFn = (
@@ -1489,7 +1490,17 @@ function buildGitActionsForPane({
});
}
export function GitDiffPane({ serverId, workspaceId, cwd, hideHeaderRow }: GitDiffPaneProps) {
function shouldEnableCheckoutDiff(input: { paneEnabled: boolean; isGit: boolean }): boolean {
return input.paneEnabled && input.isGit;
}
export function GitDiffPane({
serverId,
workspaceId,
cwd,
hideHeaderRow,
enabled = true,
}: GitDiffPaneProps) {
const { theme } = useUnistyles();
const toast = useToast();
const isMobile = useIsCompactFormFactor();
@@ -1594,7 +1605,7 @@ export function GitDiffPane({ serverId, workspaceId, cwd, hideHeaderRow }: GitDi
mode: diffMode,
baseRef,
ignoreWhitespace: changesPreferences.hideWhitespace,
enabled: isGit,
enabled: shouldEnableCheckoutDiff({ paneEnabled: enabled, isGit }),
});
const {
status: prStatus,
@@ -1,7 +1,5 @@
import { skipToken, useQuery, useQueryClient } from "@tanstack/react-query";
import { useEffect, useId, useMemo } from "react";
import { useIsCompactFormFactor } from "@/constants/layout";
import { selectIsFileExplorerOpen, usePanelStore } from "@/stores/panel-store";
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
import type { SubscribeCheckoutDiffResponse } from "@server/shared/messages";
import { orderCheckoutDiffFiles } from "./checkout-diff-order";
@@ -58,9 +56,6 @@ export function useCheckoutDiffQuery({
const queryClient = useQueryClient();
const client = useHostRuntimeClient(serverId);
const isConnected = useHostRuntimeIsConnected(serverId);
const isMobile = useIsCompactFormFactor();
const explorerTab = usePanelStore((state) => state.explorerTab);
const isOpen = usePanelStore((state) => selectIsFileExplorerOpen(state, { isCompact: isMobile }));
const hookInstanceId = useId();
const normalizedCompare = useMemo(
() => normalizeCheckoutDiffCompare({ mode, baseRef, ignoreWhitespace }),
@@ -84,9 +79,6 @@ export function useCheckoutDiffQuery({
if (!client || !isConnected || !cwd || !enabled) {
return;
}
if (!isOpen || explorerTab !== "changes") {
return;
}
const subscriptionId = [
"checkoutDiff",
@@ -173,8 +165,6 @@ export function useCheckoutDiffQuery({
isConnected,
cwd,
enabled,
isOpen,
explorerTab,
hookInstanceId,
serverId,
compareMode,