Fix visible changes pane diff subscription
This commit is contained in:
@@ -483,6 +483,7 @@ function SidebarContent({
|
|||||||
workspaceId={workspaceId}
|
workspaceId={workspaceId}
|
||||||
cwd={workspaceRoot}
|
cwd={workspaceRoot}
|
||||||
hideHeaderRow={!isMobile}
|
hideHeaderRow={!isMobile}
|
||||||
|
enabled={isOpen}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{resolvedTab === "files" && (
|
{resolvedTab === "files" && (
|
||||||
|
|||||||
@@ -746,6 +746,7 @@ interface GitDiffPaneProps {
|
|||||||
workspaceId?: string | null;
|
workspaceId?: string | null;
|
||||||
cwd: string;
|
cwd: string;
|
||||||
hideHeaderRow?: boolean;
|
hideHeaderRow?: boolean;
|
||||||
|
enabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
type PressableStyleFn = (
|
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 { theme } = useUnistyles();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const isMobile = useIsCompactFormFactor();
|
const isMobile = useIsCompactFormFactor();
|
||||||
@@ -1594,7 +1605,7 @@ export function GitDiffPane({ serverId, workspaceId, cwd, hideHeaderRow }: GitDi
|
|||||||
mode: diffMode,
|
mode: diffMode,
|
||||||
baseRef,
|
baseRef,
|
||||||
ignoreWhitespace: changesPreferences.hideWhitespace,
|
ignoreWhitespace: changesPreferences.hideWhitespace,
|
||||||
enabled: isGit,
|
enabled: shouldEnableCheckoutDiff({ paneEnabled: enabled, isGit }),
|
||||||
});
|
});
|
||||||
const {
|
const {
|
||||||
status: prStatus,
|
status: prStatus,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { skipToken, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { skipToken, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useEffect, useId, useMemo } from "react";
|
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 { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||||
import type { SubscribeCheckoutDiffResponse } from "@server/shared/messages";
|
import type { SubscribeCheckoutDiffResponse } from "@server/shared/messages";
|
||||||
import { orderCheckoutDiffFiles } from "./checkout-diff-order";
|
import { orderCheckoutDiffFiles } from "./checkout-diff-order";
|
||||||
@@ -58,9 +56,6 @@ export function useCheckoutDiffQuery({
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const client = useHostRuntimeClient(serverId);
|
const client = useHostRuntimeClient(serverId);
|
||||||
const isConnected = useHostRuntimeIsConnected(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 hookInstanceId = useId();
|
||||||
const normalizedCompare = useMemo(
|
const normalizedCompare = useMemo(
|
||||||
() => normalizeCheckoutDiffCompare({ mode, baseRef, ignoreWhitespace }),
|
() => normalizeCheckoutDiffCompare({ mode, baseRef, ignoreWhitespace }),
|
||||||
@@ -84,9 +79,6 @@ export function useCheckoutDiffQuery({
|
|||||||
if (!client || !isConnected || !cwd || !enabled) {
|
if (!client || !isConnected || !cwd || !enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isOpen || explorerTab !== "changes") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const subscriptionId = [
|
const subscriptionId = [
|
||||||
"checkoutDiff",
|
"checkoutDiff",
|
||||||
@@ -173,8 +165,6 @@ export function useCheckoutDiffQuery({
|
|||||||
isConnected,
|
isConnected,
|
||||||
cwd,
|
cwd,
|
||||||
enabled,
|
enabled,
|
||||||
isOpen,
|
|
||||||
explorerTab,
|
|
||||||
hookInstanceId,
|
hookInstanceId,
|
||||||
serverId,
|
serverId,
|
||||||
compareMode,
|
compareMode,
|
||||||
|
|||||||
Reference in New Issue
Block a user