- {/* Row 2: Git info (branch + PR badge) */}
+ {/* Branch + PR badge */}
{(showBranchSubtitle || pr) && (
{showBranchSubtitle && (
@@ -611,7 +603,6 @@ export function WorkspaceListItem({
);
- // Wrap with context menu and hover card
if (isBranchWorkspace) {
return (
<>
diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/ChangesContent.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/ChangesContent.tsx
index a412d45d296..ad11d5d024e 100644
--- a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/ChangesContent.tsx
+++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/ChangesContent.tsx
@@ -1,6 +1,6 @@
import { useParams } from "@tanstack/react-router";
import { electronTrpc } from "renderer/lib/electron-trpc";
-import { useChangesStore } from "renderer/stores/changes";
+import { useGitChangesStatus } from "renderer/screens/main/hooks/useGitChangesStatus";
import { InfiniteScrollView } from "./components/InfiniteScrollView";
export function ChangesContent() {
@@ -11,23 +11,11 @@ export function ChangesContent() {
);
const worktreePath = workspace?.worktreePath;
- const { getBaseBranch } = useChangesStore();
- const baseBranch = getBaseBranch(worktreePath || "");
- const { data: branchData } = electronTrpc.changes.getBranches.useQuery(
- { worktreePath: worktreePath || "" },
- { enabled: !!worktreePath },
- );
-
- const effectiveBaseBranch = baseBranch ?? branchData?.defaultBranch ?? "main";
-
- const { data: status, isLoading } = electronTrpc.changes.getStatus.useQuery(
- { worktreePath: worktreePath || "", defaultBranch: effectiveBaseBranch },
- {
- enabled: !!worktreePath,
- refetchInterval: 2500,
- refetchOnWindowFocus: true,
- },
- );
+ const { status, isLoading, effectiveBaseBranch } = useGitChangesStatus({
+ worktreePath,
+ refetchInterval: 2500,
+ refetchOnWindowFocus: true,
+ });
if (!worktreePath) {
return (
diff --git a/apps/desktop/src/renderer/screens/main/hooks/index.ts b/apps/desktop/src/renderer/screens/main/hooks/index.ts
index b6ab6ddd54e..ec36673d68e 100644
--- a/apps/desktop/src/renderer/screens/main/hooks/index.ts
+++ b/apps/desktop/src/renderer/screens/main/hooks/index.ts
@@ -1,3 +1,4 @@
export { useBranchSyncInvalidation } from "./useBranchSyncInvalidation";
+export { useGitChangesStatus } from "./useGitChangesStatus";
export { usePRStatus } from "./usePRStatus";
export { useWorkspaceRename } from "./useWorkspaceRename";
diff --git a/apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/index.ts b/apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/index.ts
new file mode 100644
index 00000000000..6512ff9a62c
--- /dev/null
+++ b/apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/index.ts
@@ -0,0 +1 @@
+export { useGitChangesStatus } from "./useGitChangesStatus";
diff --git a/apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/useGitChangesStatus.ts b/apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/useGitChangesStatus.ts
new file mode 100644
index 00000000000..8bf45ddd5ad
--- /dev/null
+++ b/apps/desktop/src/renderer/screens/main/hooks/useGitChangesStatus/useGitChangesStatus.ts
@@ -0,0 +1,43 @@
+import { electronTrpc } from "renderer/lib/electron-trpc";
+import { useChangesStore } from "renderer/stores/changes";
+
+interface UseGitChangesStatusOptions {
+ worktreePath: string | undefined;
+ enabled?: boolean;
+ refetchInterval?: number;
+ refetchOnWindowFocus?: boolean;
+ staleTime?: number;
+}
+
+export function useGitChangesStatus({
+ worktreePath,
+ enabled = true,
+ refetchInterval,
+ refetchOnWindowFocus,
+ staleTime,
+}: UseGitChangesStatusOptions) {
+ const { getBaseBranch } = useChangesStore();
+ const baseBranch = getBaseBranch(worktreePath || "");
+
+ const { data: branchData } = electronTrpc.changes.getBranches.useQuery(
+ { worktreePath: worktreePath || "" },
+ { enabled: enabled && !!worktreePath },
+ );
+
+ const effectiveBaseBranch = baseBranch ?? branchData?.defaultBranch ?? "main";
+
+ const { data: status, isLoading } = electronTrpc.changes.getStatus.useQuery(
+ {
+ worktreePath: worktreePath || "",
+ defaultBranch: effectiveBaseBranch,
+ },
+ {
+ enabled: enabled && !!worktreePath,
+ refetchInterval,
+ refetchOnWindowFocus,
+ staleTime,
+ },
+ );
+
+ return { status, isLoading, effectiveBaseBranch };
+}