Update files
This commit is contained in:
@@ -171,7 +171,7 @@ export function AgentList({
|
||||
|
||||
void queryClient.prefetchQuery({
|
||||
queryKey,
|
||||
queryFn: async () => await client.getCheckoutStatus(agent.id, { cwd: agent.cwd }),
|
||||
queryFn: async () => await client.getCheckoutStatus(agent.cwd),
|
||||
staleTime: CHECKOUT_STATUS_STALE_TIME,
|
||||
});
|
||||
}
|
||||
@@ -192,7 +192,6 @@ export function AgentList({
|
||||
|
||||
const checkoutQuery = useCheckoutStatusCacheOnly({
|
||||
serverId: agent.serverId,
|
||||
agentId: agent.id,
|
||||
cwd: agent.cwd,
|
||||
});
|
||||
const checkout = checkoutQuery.data ?? null;
|
||||
|
||||
@@ -251,7 +251,7 @@ function SidebarContent({
|
||||
isMobile,
|
||||
}: SidebarContentProps) {
|
||||
const { theme } = useUnistyles();
|
||||
const { status } = useCheckoutStatusQuery({ serverId, agentId, cwd });
|
||||
const { status } = useCheckoutStatusQuery({ serverId, cwd });
|
||||
const isGit = status?.isGit ?? false;
|
||||
|
||||
// If not a git repo, only show files tab
|
||||
|
||||
@@ -432,7 +432,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
const [actionError, setActionError] = useState<string | null>(null);
|
||||
const [shipDefault, setShipDefault] = useState<"merge" | "pr">("merge");
|
||||
const { status, isLoading: isStatusLoading, isFetching: isStatusFetching, isError: isStatusError, error: statusError, refresh: refreshStatus } =
|
||||
useCheckoutStatusQuery({ serverId, agentId, cwd });
|
||||
useCheckoutStatusQuery({ serverId, cwd });
|
||||
const gitStatus = status && status.isGit ? status : null;
|
||||
const isGit = Boolean(gitStatus);
|
||||
const notGit = status !== null && !status.isGit && !status.error;
|
||||
@@ -456,7 +456,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
refresh: refreshDiff,
|
||||
} = useCheckoutDiffQuery({
|
||||
serverId,
|
||||
agentId,
|
||||
cwd,
|
||||
mode: diffMode,
|
||||
baseRef,
|
||||
enabled: isGit,
|
||||
@@ -467,7 +467,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
refresh: refreshPrStatus,
|
||||
} = useCheckoutPrStatusQuery({
|
||||
serverId,
|
||||
agentId,
|
||||
cwd,
|
||||
enabled: isGit,
|
||||
});
|
||||
// Track user-initiated refresh to avoid iOS RefreshControl animation on background fetches
|
||||
@@ -583,16 +583,12 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
});
|
||||
}, [agentId, diffMetrics, isDiffFetching, isDiffLoading, serverId]);
|
||||
|
||||
const agentExists = useSessionStore((state) =>
|
||||
state.sessions[serverId]?.agents?.has(agentId) ?? false
|
||||
);
|
||||
|
||||
const commitMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client unavailable");
|
||||
}
|
||||
const payload = await client.checkoutCommit(agentId, { addAll: true });
|
||||
const payload = await client.checkoutCommit(cwd, { addAll: true });
|
||||
if (payload.error) {
|
||||
throw new Error(payload.error.message);
|
||||
}
|
||||
@@ -614,7 +610,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client unavailable");
|
||||
}
|
||||
const payload = await client.checkoutPrCreate(agentId, {});
|
||||
const payload = await client.checkoutPrCreate(cwd, {});
|
||||
if (payload.error) {
|
||||
throw new Error(payload.error.message);
|
||||
}
|
||||
@@ -635,7 +631,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client unavailable");
|
||||
}
|
||||
const payload = await client.checkoutMerge(agentId, {
|
||||
const payload = await client.checkoutMerge(cwd, {
|
||||
baseRef,
|
||||
strategy: "merge",
|
||||
requireCleanTarget: true,
|
||||
@@ -661,7 +657,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client unavailable");
|
||||
}
|
||||
const payload = await client.checkoutMergeFromBase(agentId, {
|
||||
const payload = await client.checkoutMergeFromBase(cwd, {
|
||||
baseRef,
|
||||
requireCleanTarget: true,
|
||||
});
|
||||
@@ -686,7 +682,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client unavailable");
|
||||
}
|
||||
const payload = await client.checkoutPush(agentId);
|
||||
const payload = await client.checkoutPush(cwd);
|
||||
if (payload.error) {
|
||||
throw new Error(payload.error.message);
|
||||
}
|
||||
@@ -753,14 +749,6 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
|
||||
const keyExtractor = useCallback((item: ParsedDiffFile) => item.path, []);
|
||||
|
||||
if (!agentExists) {
|
||||
return (
|
||||
<View style={styles.errorContainer}>
|
||||
<Text style={styles.errorText}>Agent not found</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const hasChanges = files.length > 0;
|
||||
const diffErrorMessage =
|
||||
diffPayloadError?.message ??
|
||||
@@ -770,6 +758,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
gitStatus?.currentBranch ?? (notGit ? "Not a git repository" : "Unknown");
|
||||
const actionsDisabled = !isGit || Boolean(status?.error) || isStatusLoading;
|
||||
const aheadCount = gitStatus?.aheadBehind?.ahead ?? 0;
|
||||
const aheadOfOrigin = gitStatus?.aheadOfOrigin ?? 0;
|
||||
const baseRefLabel = useMemo(() => {
|
||||
if (!baseRef) return "base";
|
||||
const trimmed = baseRef.replace(/^refs\/(heads|remotes)\//, "").trim();
|
||||
@@ -855,13 +844,15 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
// ==========================================================================
|
||||
// Rules (in priority order):
|
||||
// 1. Uncommitted changes → "Commit" is primary
|
||||
// 2. Has PR → "View PR" is primary
|
||||
// 3. Ahead of base → "Merge branch" or "Create PR" based on shipDefault preference
|
||||
// 4. Nothing to do → no primary CTA
|
||||
// 2. Ahead of origin (unpushed commits) → "Push" is primary
|
||||
// 3. Has PR → "View PR" is primary
|
||||
// 4. Ahead of base → "Merge branch" or "Create PR" based on shipDefault preference
|
||||
// 5. Nothing to do → no primary CTA
|
||||
// ==========================================================================
|
||||
|
||||
type PrimaryCTA =
|
||||
| { type: "commit" }
|
||||
| { type: "push" }
|
||||
| { type: "view-pr"; url: string }
|
||||
| { type: "ship"; action: "merge" | "create-pr" }
|
||||
| null;
|
||||
@@ -874,12 +865,17 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
return { type: "commit" };
|
||||
}
|
||||
|
||||
// Rule 2: Has PR → View PR
|
||||
// Rule 2: Ahead of origin → Push
|
||||
if (aheadOfOrigin > 0 && !pushDisabled) {
|
||||
return { type: "push" };
|
||||
}
|
||||
|
||||
// Rule 3: Has PR → View PR
|
||||
if (hasPullRequest && prStatus?.url) {
|
||||
return { type: "view-pr", url: prStatus.url };
|
||||
}
|
||||
|
||||
// Rule 3: Ahead of base → Ship (merge or create PR based on preference)
|
||||
// Rule 4: Ahead of base → Ship (merge or create PR based on preference)
|
||||
if (aheadCount > 0) {
|
||||
const preferredAction = shipDefault === "merge" ? "merge" : "create-pr";
|
||||
// If preferred action is disabled, fall back to the other
|
||||
@@ -892,15 +888,17 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
return { type: "ship", action: preferredAction };
|
||||
}
|
||||
|
||||
// Rule 4: Nothing to do
|
||||
// Rule 5: Nothing to do
|
||||
return null;
|
||||
}, [isGit, hasUncommittedChanges, hasPullRequest, prStatus?.url, aheadCount, shipDefault, mergeDisabled, prDisabled]);
|
||||
}, [isGit, hasUncommittedChanges, aheadOfOrigin, pushDisabled, hasPullRequest, prStatus?.url, aheadCount, shipDefault, mergeDisabled, prDisabled]);
|
||||
|
||||
const primaryCTALabel = useMemo(() => {
|
||||
if (!primaryCTA) return "";
|
||||
switch (primaryCTA.type) {
|
||||
case "commit":
|
||||
return "Commit";
|
||||
case "push":
|
||||
return "Push";
|
||||
case "view-pr":
|
||||
return "View PR";
|
||||
case "ship":
|
||||
@@ -913,24 +911,28 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
switch (primaryCTA.type) {
|
||||
case "commit":
|
||||
return commitDisabled;
|
||||
case "push":
|
||||
return pushDisabled;
|
||||
case "view-pr":
|
||||
return false; // View PR is never disabled
|
||||
case "ship":
|
||||
return primaryCTA.action === "merge" ? mergeDisabled : prDisabled;
|
||||
}
|
||||
}, [primaryCTA, actionsDisabled, commitDisabled, mergeDisabled, prDisabled]);
|
||||
}, [primaryCTA, actionsDisabled, commitDisabled, pushDisabled, mergeDisabled, prDisabled]);
|
||||
|
||||
const primaryCTAStatus: ActionStatus = useMemo(() => {
|
||||
if (!primaryCTA) return "idle";
|
||||
switch (primaryCTA.type) {
|
||||
case "commit":
|
||||
return commitAction.status;
|
||||
case "push":
|
||||
return pushAction.status;
|
||||
case "view-pr":
|
||||
return "idle"; // View PR is instant, no status
|
||||
case "ship":
|
||||
return primaryCTA.action === "merge" ? mergeAction.status : prCreateAction.status;
|
||||
}
|
||||
}, [primaryCTA, commitAction.status, mergeAction.status, prCreateAction.status]);
|
||||
}, [primaryCTA, commitAction.status, pushAction.status, mergeAction.status, prCreateAction.status]);
|
||||
|
||||
const primaryCTADisplayLabel = useMemo(() => {
|
||||
if (!primaryCTA) return "";
|
||||
@@ -941,6 +943,10 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
if (status === "pending") return "Committing...";
|
||||
if (status === "success") return "Committed";
|
||||
return "Commit";
|
||||
case "push":
|
||||
if (status === "pending") return "Pushing...";
|
||||
if (status === "success") return "Pushed";
|
||||
return "Push";
|
||||
case "view-pr":
|
||||
return "View PR";
|
||||
case "ship":
|
||||
@@ -962,6 +968,9 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
case "commit":
|
||||
commitAction.trigger();
|
||||
break;
|
||||
case "push":
|
||||
pushAction.trigger();
|
||||
break;
|
||||
case "view-pr":
|
||||
openURLInNewTab(primaryCTA.url);
|
||||
break;
|
||||
@@ -973,7 +982,7 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, [primaryCTA, primaryCTADisabled, primaryCTAStatus, commitAction, mergeAction, prCreateAction]);
|
||||
}, [primaryCTA, primaryCTADisabled, primaryCTAStatus, commitAction, pushAction, mergeAction, prCreateAction]);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
||||
@@ -93,7 +93,6 @@ function SectionHeader({
|
||||
// For project sections, try to get repo name from checkout status
|
||||
const checkoutQuery = useCheckoutStatusCacheOnly({
|
||||
serverId: section.firstAgentServerId ?? "",
|
||||
agentId: section.firstAgentId ?? "",
|
||||
cwd: section.workingDir ?? "",
|
||||
});
|
||||
const checkout = checkoutQuery.data ?? null;
|
||||
@@ -299,7 +298,7 @@ export function GroupedAgentList({
|
||||
|
||||
void queryClient.prefetchQuery({
|
||||
queryKey,
|
||||
queryFn: async () => await client.getCheckoutStatus(agent.id, { cwd: agent.cwd }),
|
||||
queryFn: async () => await client.getCheckoutStatus(agent.cwd),
|
||||
staleTime: CHECKOUT_STATUS_STALE_TIME,
|
||||
});
|
||||
}
|
||||
@@ -409,7 +408,6 @@ export function GroupedAgentList({
|
||||
|
||||
const checkoutQuery = useCheckoutStatusCacheOnly({
|
||||
serverId: agent.serverId,
|
||||
agentId: agent.id,
|
||||
cwd: agent.cwd,
|
||||
});
|
||||
const checkout = checkoutQuery.data ?? null;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
export type CheckoutStatusRevalidationParams = {
|
||||
serverId: string;
|
||||
agentId: string;
|
||||
cwd: string;
|
||||
isOpen: boolean;
|
||||
explorerTab: string;
|
||||
};
|
||||
|
||||
export function checkoutStatusRevalidationKey(params: CheckoutStatusRevalidationParams): string | null {
|
||||
if (!params.agentId) return null;
|
||||
if (!params.cwd) return null;
|
||||
if (!params.isOpen) return null;
|
||||
if (params.explorerTab !== "changes") return null;
|
||||
return `${params.serverId}:${params.agentId}`;
|
||||
return `${params.serverId}:${params.cwd}`;
|
||||
}
|
||||
|
||||
export function nextCheckoutStatusRefetchDecision(
|
||||
|
||||
@@ -9,16 +9,16 @@ const CHECKOUT_DIFF_STALE_TIME = 30_000;
|
||||
|
||||
function checkoutDiffQueryKey(
|
||||
serverId: string,
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
mode: "uncommitted" | "base",
|
||||
baseRef?: string
|
||||
) {
|
||||
return ["checkoutDiff", serverId, agentId, mode, baseRef ?? ""] as const;
|
||||
return ["checkoutDiff", serverId, cwd, mode, baseRef ?? ""] as const;
|
||||
}
|
||||
|
||||
interface UseCheckoutDiffQueryOptions {
|
||||
serverId: string;
|
||||
agentId: string;
|
||||
cwd: string;
|
||||
mode: "uncommitted" | "base";
|
||||
baseRef?: string;
|
||||
enabled?: boolean;
|
||||
@@ -31,7 +31,7 @@ export type HighlightToken = NonNullable<DiffLine["tokens"]>[number];
|
||||
|
||||
export function useCheckoutDiffQuery({
|
||||
serverId,
|
||||
agentId,
|
||||
cwd,
|
||||
mode,
|
||||
baseRef,
|
||||
enabled = true,
|
||||
@@ -51,27 +51,27 @@ export function useCheckoutDiffQuery({
|
||||
const isOpen = isMobile ? mobileView === "file-explorer" : desktopFileExplorerOpen;
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: checkoutDiffQueryKey(serverId, agentId, mode, baseRef),
|
||||
queryKey: checkoutDiffQueryKey(serverId, cwd, mode, baseRef),
|
||||
queryFn: async () => {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client not available");
|
||||
}
|
||||
return await client.getCheckoutDiff(agentId, { mode, baseRef });
|
||||
return await client.getCheckoutDiff(cwd, { mode, baseRef });
|
||||
},
|
||||
enabled: !!client && isConnected && !!agentId && enabled,
|
||||
enabled: !!client && isConnected && !!cwd && enabled,
|
||||
staleTime: CHECKOUT_DIFF_STALE_TIME,
|
||||
refetchInterval: 10_000,
|
||||
});
|
||||
|
||||
// Revalidate when sidebar opens with "changes" tab active
|
||||
useEffect(() => {
|
||||
if (!isOpen || explorerTab !== "changes" || !agentId) {
|
||||
if (!isOpen || explorerTab !== "changes" || !cwd) {
|
||||
return;
|
||||
}
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: checkoutDiffQueryKey(serverId, agentId, mode, baseRef),
|
||||
queryKey: checkoutDiffQueryKey(serverId, cwd, mode, baseRef),
|
||||
});
|
||||
}, [isOpen, explorerTab, serverId, agentId, mode, baseRef, queryClient]);
|
||||
}, [isOpen, explorerTab, serverId, cwd, mode, baseRef, queryClient]);
|
||||
|
||||
const refresh = useCallback(() => {
|
||||
return query.refetch();
|
||||
|
||||
@@ -4,13 +4,13 @@ import type { CheckoutPrStatusResponse } from "@server/shared/messages";
|
||||
|
||||
const CHECKOUT_PR_STATUS_STALE_TIME = 20_000;
|
||||
|
||||
function checkoutPrStatusQueryKey(serverId: string, agentId: string) {
|
||||
return ["checkoutPrStatus", serverId, agentId] as const;
|
||||
function checkoutPrStatusQueryKey(serverId: string, cwd: string) {
|
||||
return ["checkoutPrStatus", serverId, cwd] as const;
|
||||
}
|
||||
|
||||
interface UseCheckoutPrStatusQueryOptions {
|
||||
serverId: string;
|
||||
agentId: string;
|
||||
cwd: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export type CheckoutPrStatusPayload = CheckoutPrStatusResponse["payload"];
|
||||
|
||||
export function useCheckoutPrStatusQuery({
|
||||
serverId,
|
||||
agentId,
|
||||
cwd,
|
||||
enabled = true,
|
||||
}: UseCheckoutPrStatusQueryOptions) {
|
||||
const client = useSessionStore(
|
||||
@@ -29,14 +29,14 @@ export function useCheckoutPrStatusQuery({
|
||||
);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: checkoutPrStatusQueryKey(serverId, agentId),
|
||||
queryKey: checkoutPrStatusQueryKey(serverId, cwd),
|
||||
queryFn: async () => {
|
||||
if (!client) {
|
||||
throw new Error("Daemon client not available");
|
||||
}
|
||||
return await client.checkoutPrStatus(agentId);
|
||||
return await client.checkoutPrStatus(cwd);
|
||||
},
|
||||
enabled: !!client && isConnected && !!agentId && enabled,
|
||||
enabled: !!client && isConnected && !!cwd && enabled,
|
||||
staleTime: CHECKOUT_PR_STATUS_STALE_TIME,
|
||||
refetchInterval: 15_000,
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ describe("useCheckoutStatusQuery", () => {
|
||||
expect(
|
||||
checkoutStatusRevalidationKey({
|
||||
serverId: "daemon-1",
|
||||
agentId: "agent-1",
|
||||
cwd: "/path/to/project",
|
||||
isOpen: false,
|
||||
explorerTab: "changes",
|
||||
})
|
||||
@@ -18,7 +18,7 @@ describe("useCheckoutStatusQuery", () => {
|
||||
expect(
|
||||
checkoutStatusRevalidationKey({
|
||||
serverId: "daemon-1",
|
||||
agentId: "agent-1",
|
||||
cwd: "/path/to/project",
|
||||
isOpen: true,
|
||||
explorerTab: "files",
|
||||
})
|
||||
@@ -29,11 +29,11 @@ describe("useCheckoutStatusQuery", () => {
|
||||
expect(
|
||||
checkoutStatusRevalidationKey({
|
||||
serverId: "daemon-1",
|
||||
agentId: "agent-1",
|
||||
cwd: "/path/to/project",
|
||||
isOpen: true,
|
||||
explorerTab: "changes",
|
||||
})
|
||||
).toBe("daemon-1:agent-1");
|
||||
).toBe("daemon-1:/path/to/project");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -17,21 +17,19 @@ export function checkoutStatusQueryKey(serverId: string, cwd: string) {
|
||||
|
||||
interface UseCheckoutStatusQueryOptions {
|
||||
serverId: string;
|
||||
agentId: string;
|
||||
cwd: string;
|
||||
}
|
||||
|
||||
export type CheckoutStatusPayload = CheckoutStatusResponse["payload"];
|
||||
|
||||
function fetchCheckoutStatus(
|
||||
client: { getCheckoutStatus: (agentId: string, options?: { cwd?: string }) => Promise<CheckoutStatusPayload> },
|
||||
agentId: string,
|
||||
client: { getCheckoutStatus: (cwd: string) => Promise<CheckoutStatusPayload> },
|
||||
cwd: string
|
||||
): Promise<CheckoutStatusPayload> {
|
||||
return client.getCheckoutStatus(agentId, { cwd });
|
||||
return client.getCheckoutStatus(cwd);
|
||||
}
|
||||
|
||||
export function useCheckoutStatusQuery({ serverId, agentId, cwd }: UseCheckoutStatusQueryOptions) {
|
||||
export function useCheckoutStatusQuery({ serverId, cwd }: UseCheckoutStatusQueryOptions) {
|
||||
const client = useSessionStore(
|
||||
(state) => state.sessions[serverId]?.client ?? null
|
||||
);
|
||||
@@ -51,9 +49,9 @@ export function useCheckoutStatusQuery({ serverId, agentId, cwd }: UseCheckoutSt
|
||||
if (!client) {
|
||||
throw new Error("Daemon client not available");
|
||||
}
|
||||
return await fetchCheckoutStatus(client, agentId, cwd);
|
||||
return await fetchCheckoutStatus(client, cwd);
|
||||
},
|
||||
enabled: !!client && isConnected && !!agentId && !!cwd,
|
||||
enabled: !!client && isConnected && !!cwd,
|
||||
staleTime: CHECKOUT_STATUS_STALE_TIME,
|
||||
refetchInterval: 10_000,
|
||||
refetchIntervalInBackground: true,
|
||||
@@ -62,8 +60,8 @@ export function useCheckoutStatusQuery({ serverId, agentId, cwd }: UseCheckoutSt
|
||||
|
||||
// Revalidate when sidebar is open with "changes" tab active.
|
||||
const revalidationKey = useMemo(
|
||||
() => checkoutStatusRevalidationKey({ serverId, agentId, isOpen, explorerTab }),
|
||||
[serverId, agentId, isOpen, explorerTab]
|
||||
() => checkoutStatusRevalidationKey({ serverId, cwd, isOpen, explorerTab }),
|
||||
[serverId, cwd, isOpen, explorerTab]
|
||||
);
|
||||
const lastRevalidationKey = useRef<string | null>(null);
|
||||
useEffect(() => {
|
||||
@@ -88,7 +86,7 @@ export function useCheckoutStatusQuery({ serverId, agentId, cwd }: UseCheckoutSt
|
||||
* initiating a fetch. Useful for list rows where a parent component prefetches
|
||||
* only the visible agents.
|
||||
*/
|
||||
export function useCheckoutStatusCacheOnly({ serverId, agentId, cwd }: UseCheckoutStatusQueryOptions) {
|
||||
export function useCheckoutStatusCacheOnly({ serverId, cwd }: UseCheckoutStatusQueryOptions) {
|
||||
const client = useSessionStore(
|
||||
(state) => state.sessions[serverId]?.client ?? null
|
||||
);
|
||||
@@ -99,7 +97,7 @@ export function useCheckoutStatusCacheOnly({ serverId, agentId, cwd }: UseChecko
|
||||
if (!client) {
|
||||
throw new Error("Daemon client not available");
|
||||
}
|
||||
return await fetchCheckoutStatus(client, agentId, cwd);
|
||||
return await fetchCheckoutStatus(client, cwd);
|
||||
},
|
||||
enabled: false,
|
||||
staleTime: CHECKOUT_STATUS_STALE_TIME,
|
||||
|
||||
@@ -414,7 +414,6 @@ function AgentScreenContent({
|
||||
// Checkout status for header subtitle
|
||||
const checkoutStatusQuery = useCheckoutStatusQuery({
|
||||
serverId,
|
||||
agentId: resolvedAgentId ?? "",
|
||||
cwd: agent?.cwd ?? "",
|
||||
});
|
||||
const checkout = checkoutStatusQuery.status;
|
||||
|
||||
Reference in New Issue
Block a user