mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 08:04:05 +00:00
fix(sidebar): reconcile folder updates by owner
This commit is contained in:
@@ -238,4 +238,38 @@ describe('same-id cross-host folder workspace identity', () => {
|
||||
updates: { name: 'Updated' }
|
||||
})
|
||||
})
|
||||
|
||||
it('reconciles a failed same-id update from the selected owner row', async () => {
|
||||
const local = makeFolder({ name: 'Local current', executionHostId: 'local' })
|
||||
const ssh = makeFolder({
|
||||
name: 'SSH current',
|
||||
folderPath: '/remote/folder',
|
||||
connectionId: 'builder'
|
||||
})
|
||||
const list = vi.fn().mockResolvedValue([
|
||||
{ ...local, name: 'Local persisted' },
|
||||
{ ...ssh, name: 'SSH persisted' }
|
||||
])
|
||||
const update = vi.fn().mockResolvedValue(null)
|
||||
const store = createTestStore()
|
||||
store.setState({
|
||||
projectGroups: [
|
||||
makeGroup({ executionHostId: 'local' }),
|
||||
makeGroup({ connectionId: 'builder', parentPath: '/remote' })
|
||||
],
|
||||
folderWorkspaces: [local, ssh]
|
||||
})
|
||||
vi.stubGlobal('window', { api: { folderWorkspaces: { list, update } } })
|
||||
|
||||
await expect(
|
||||
store
|
||||
.getState()
|
||||
.updateFolderWorkspace('same-id', { name: 'Rejected' }, { executionHostId: 'ssh:builder' })
|
||||
).resolves.toBe(false)
|
||||
|
||||
expect(store.getState().folderWorkspaces.map((workspace) => workspace.name)).toEqual([
|
||||
'Local current',
|
||||
'SSH persisted'
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1347,7 +1347,9 @@ async function reconcileFailedFolderWorkspaceUpdate(args: {
|
||||
return
|
||||
}
|
||||
const refreshed = catalog.folderWorkspaces.find(
|
||||
(workspace) => workspace.id === args.folderWorkspaceId
|
||||
(workspace) =>
|
||||
workspace.id === args.folderWorkspaceId &&
|
||||
getFolderWorkspaceHostId(workspace, args.get().projectGroups) === args.ownerHostId
|
||||
)
|
||||
args.set((state) => ({
|
||||
folderWorkspaces: refreshed
|
||||
|
||||
Reference in New Issue
Block a user