fix(sidebar): reconcile folder updates by owner

This commit is contained in:
Brennan Benson
2026-08-10 14:00:28 -07:00
parent ec33eef639
commit bc1714b6f0
2 changed files with 37 additions and 1 deletions
@@ -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'
])
})
})
+3 -1
View File
@@ -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