fix(workspace): resolve folder lookups against all folders for branch and file tree
This commit is contained in:
@@ -24,14 +24,14 @@ export function TabBar() {
|
||||
toggleTileMode,
|
||||
reorderTabs,
|
||||
} = useTabContext()
|
||||
const { folders, branches } = useAppWorkspace()
|
||||
const { allFolders, branches } = useAppWorkspace()
|
||||
const { mode, activePane } = useWorkspaceContext()
|
||||
|
||||
const folderIndex = useMemo(() => {
|
||||
const map = new Map<number, { name: string }>()
|
||||
for (const f of folders) map.set(f.id, { name: f.name })
|
||||
for (const f of allFolders) map.set(f.id, { name: f.name })
|
||||
return map
|
||||
}, [folders])
|
||||
}, [allFolders])
|
||||
|
||||
const handleRevealInSidebar = useCallback((folderId: number) => {
|
||||
window.dispatchEvent(
|
||||
|
||||
@@ -20,14 +20,14 @@ export function useActiveFolder() {
|
||||
}
|
||||
|
||||
export function ActiveFolderProvider({ children }: { children: ReactNode }) {
|
||||
const { folders, activeFolderId } = useAppWorkspace()
|
||||
const { allFolders, activeFolderId } = useAppWorkspace()
|
||||
|
||||
const activeFolder = useMemo(
|
||||
() =>
|
||||
activeFolderId != null
|
||||
? (folders.find((f) => f.id === activeFolderId) ?? null)
|
||||
? (allFolders.find((f) => f.id === activeFolderId) ?? null)
|
||||
: null,
|
||||
[activeFolderId, folders]
|
||||
[activeFolderId, allFolders]
|
||||
)
|
||||
|
||||
const value = useMemo<ActiveFolderContextValue>(
|
||||
|
||||
@@ -135,7 +135,7 @@ export function AppWorkspaceProvider({ children }: AppWorkspaceProviderProps) {
|
||||
setAllFolders(allList)
|
||||
setBranches((prev) => {
|
||||
const next = new Map(prev)
|
||||
for (const f of openList) {
|
||||
for (const f of allList) {
|
||||
if (!next.has(f.id)) {
|
||||
next.set(f.id, f.git_branch ?? null)
|
||||
}
|
||||
@@ -175,8 +175,8 @@ export function AppWorkspaceProvider({ children }: AppWorkspaceProviderProps) {
|
||||
}, [fetchFolders, refreshConversations])
|
||||
|
||||
const getFolder = useCallback(
|
||||
(id: number) => folders.find((f) => f.id === id),
|
||||
[folders]
|
||||
(id: number) => allFolders.find((f) => f.id === id),
|
||||
[allFolders]
|
||||
)
|
||||
|
||||
const updateConversationLocal = useCallback(
|
||||
@@ -290,7 +290,7 @@ export function AppWorkspaceProvider({ children }: AppWorkspaceProviderProps) {
|
||||
useEffect(() => {
|
||||
if (activeFolderId == null) return
|
||||
const folderId = activeFolderId
|
||||
const folder = folders.find((f) => f.id === folderId)
|
||||
const folder = allFolders.find((f) => f.id === folderId)
|
||||
if (!folder) return
|
||||
|
||||
let cancelled = false
|
||||
@@ -322,7 +322,7 @@ export function AppWorkspaceProvider({ children }: AppWorkspaceProviderProps) {
|
||||
cancelled = true
|
||||
if (timer) clearTimeout(timer)
|
||||
}
|
||||
}, [activeFolderId, folders])
|
||||
}, [activeFolderId, allFolders])
|
||||
|
||||
const stats = useMemo(
|
||||
() => (conversations.length > 0 ? computeStats(conversations) : null),
|
||||
|
||||
Reference in New Issue
Block a user