mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 08:04:05 +00:00
fix(sidebar): reveal duplicate owner folder groups
This commit is contained in:
@@ -162,6 +162,26 @@ describe('worktree list folder reveal', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('derives the owner when only project-group ids collide', () => {
|
||||
const localGroup = makeProjectGroup({ id: 'group-child', executionHostId: 'local' })
|
||||
const runtimeGroup = makeProjectGroup({
|
||||
id: 'group-child',
|
||||
executionHostId: 'runtime:env-1'
|
||||
})
|
||||
const runtimeFolder = makeFolderWorkspace({
|
||||
id: 'runtime-folder',
|
||||
executionHostId: 'runtime:env-1'
|
||||
})
|
||||
|
||||
expect(
|
||||
getFolderWorkspaceRevealGroupKeys(
|
||||
folderWorkspaceKey(runtimeFolder.id),
|
||||
[runtimeFolder],
|
||||
[localGroup, runtimeGroup]
|
||||
)
|
||||
).toEqual([getProjectGroupHeaderKey(runtimeGroup.id, 'runtime:env-1')])
|
||||
})
|
||||
|
||||
it('uses qualified DOM row keys only for collision-qualified folder rows', () => {
|
||||
expect(
|
||||
getFolderWorkspaceSidebarRowKey('folder-workspace-1', 'folder-workspace:folder-workspace-1')
|
||||
|
||||
@@ -107,16 +107,21 @@ export function getFolderWorkspaceRevealGroupKeys(
|
||||
return []
|
||||
}
|
||||
|
||||
const resolvedOwnerHostId =
|
||||
ownerHostId ?? resolveFolderWorkspaceCatalogOwnerHostId(folderWorkspace, projectGroups)
|
||||
if (!resolvedOwnerHostId) {
|
||||
return []
|
||||
}
|
||||
const projectGroupIndex = buildProjectGroupSidebarIndex(projectGroups)
|
||||
let group = findProjectGroupForSidebarOwner(
|
||||
projectGroupIndex,
|
||||
folderWorkspace.projectGroupId,
|
||||
ownerHostId
|
||||
resolvedOwnerHostId
|
||||
)
|
||||
const keys: string[] = []
|
||||
const seen = new Set<string>()
|
||||
while (group) {
|
||||
const identity = JSON.stringify([ownerHostId, group.id])
|
||||
const identity = JSON.stringify([resolvedOwnerHostId, group.id])
|
||||
if (seen.has(identity)) {
|
||||
break
|
||||
}
|
||||
@@ -124,7 +129,7 @@ export function getFolderWorkspaceRevealGroupKeys(
|
||||
keys.unshift(
|
||||
getProjectGroupHeaderKey(
|
||||
group.id,
|
||||
projectGroupIndex.ambiguousIds.has(group.id) ? ownerHostId : undefined
|
||||
projectGroupIndex.ambiguousIds.has(group.id) ? resolvedOwnerHostId : undefined
|
||||
)
|
||||
)
|
||||
group = findProjectGroupParentForSidebar(projectGroupIndex, group)
|
||||
|
||||
Reference in New Issue
Block a user