From 11a48958e84a59148244b7408df850fabc38377f Mon Sep 17 00:00:00 2001
From: jaygupta17
Date: Tue, 25 Aug 2026 20:47:02 +0530
Subject: [PATCH] fix(git): resolve blank nested-repo surfaces; add repository
pickers
The resolution gate on the pull-request, walkthrough, and mobile changes
surfaces stayed on forever (rootIsGitRepo stays false on a non-repo
root) while NestedRepoResolutionStates exits once the selected
repository probes as a repository, so those surfaces rendered nothing.
The gate now shows resolution states only while the operating directory
has not proven to be a repository, matching GitView.
Extract GitHeader's repository switcher into git/NestedRepoPicker and
mount it in the diff toolbar, a new slim header in the pull-request
view, the walkthrough header, and the mobile changes header. The pick
is shared per root, so every surface follows.
The walkthrough tab mounts keep-alive and hidden; it now receives a
visible prop so discovery waits until the tab is actually opened. Add
component tests for the shared resolution states.
---
packages/ui/src/apps/MobileChangesSurface.tsx | 19 ++++-
.../ui/src/components/layout/ContextPanel.tsx | 2 +-
packages/ui/src/components/views/DiffView.tsx | 14 +++-
.../src/components/views/PullRequestView.tsx | 62 +++++++++++------
.../ui/src/components/views/git/GitHeader.tsx | 46 +++----------
.../components/views/git/NestedRepoPicker.tsx | 67 ++++++++++++++++++
.../git/NestedRepoResolutionStates.test.tsx | 69 +++++++++++++++++++
.../views/walkthrough/WalkthroughView.tsx | 27 +++++++-
packages/ui/src/stores/DOCUMENTATION.md | 2 +-
9 files changed, 241 insertions(+), 67 deletions(-)
create mode 100644 packages/ui/src/components/views/git/NestedRepoPicker.tsx
create mode 100644 packages/ui/src/components/views/git/NestedRepoResolutionStates.test.tsx
diff --git a/packages/ui/src/apps/MobileChangesSurface.tsx b/packages/ui/src/apps/MobileChangesSurface.tsx
index 7fa06cbb..463886b3 100644
--- a/packages/ui/src/apps/MobileChangesSurface.tsx
+++ b/packages/ui/src/apps/MobileChangesSurface.tsx
@@ -23,6 +23,7 @@ import {
useGitLoadingStatus,
} from '@/stores/useGitStore';
import { NestedRepoResolutionStates } from '@/components/views/git/NestedRepoResolutionStates';
+import { NestedRepoPicker } from '@/components/views/git/NestedRepoPicker';
import { getRuntimeKey } from '@/lib/runtime-switch';
type SyncAction = 'fetch' | 'pull' | 'push' | 'sync' | null;
@@ -69,6 +70,7 @@ export const MobileChangesSurface: React.FC = ({ onCl
const setActiveDirectory = useGitStore((state) => state.setActiveDirectory);
const ensureAll = useGitStore((state) => state.ensureAll);
const ensureNestedRepos = useGitStore((state) => state.ensureNestedRepos);
+ const selectNestedRepo = useGitStore((state) => state.selectNestedRepo);
const fetchStatus = useGitStore((state) => state.fetchStatus);
const fetchBranches = useGitStore((state) => state.fetchBranches);
const prefetchDiffs = useGitStore((state) => state.prefetchDiffs);
@@ -472,6 +474,16 @@ export const MobileChangesSurface: React.FC = ({ onCl
{status?.current || currentDirectory || ''}