mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 08:37:49 +00:00
fix(browser): closing a host page retires a window-saved tab whose ids differ (STA-11998) (#33266)
This commit is contained in:
@@ -118,6 +118,32 @@ describe('a browser tab a host with no window saves', () => {
|
||||
expect(saved.browserPagesByWorkspace?.['page-1']).toBeUndefined()
|
||||
})
|
||||
|
||||
it('leaves no trace once closed when a window saved it under its own tab ids (STA-11998)', () => {
|
||||
const session = opened(sessionWithTerminal())
|
||||
const browserTab = session.browserTabsByWorktree![WT]![0]!
|
||||
const unifiedTab = session.unifiedTabs![WT]!.find((tab) => tab.id === 'page-1')!
|
||||
const group = session.tabGroups![WT]![0]!
|
||||
const windowSaved: WorkspaceSessionState = {
|
||||
...session,
|
||||
browserTabsByWorktree: { [WT]: [{ ...browserTab, id: 'browser-tab-1' }] },
|
||||
browserPagesByWorkspace: { 'browser-tab-1': session.browserPagesByWorkspace!['page-1']! },
|
||||
unifiedTabs: {
|
||||
[WT]: session.unifiedTabs![WT]!.map((tab) =>
|
||||
tab === unifiedTab ? { ...tab, id: 'unified-1', entityId: 'browser-tab-1' } : tab
|
||||
)
|
||||
},
|
||||
tabGroups: {
|
||||
[WT]: [{ ...group, tabOrder: ['term-1', 'unified-1'], activeTabId: 'unified-1' }]
|
||||
}
|
||||
}
|
||||
|
||||
const saved = withClosedServeBrowserTab(HOST, windowSaved, WT, 'page-1')!
|
||||
|
||||
expect(saved.unifiedTabs?.[WT]?.map((tab) => tab.id)).toEqual(['term-1'])
|
||||
expect(saved.browserTabsByWorktree?.[WT] ?? []).toEqual([])
|
||||
expect(findSavedBrowserPage(saved, WT, 'page-1')).toBeNull()
|
||||
})
|
||||
|
||||
it('updates only the page of a window-saved tab that is not its active one', () => {
|
||||
const session = opened(sessionWithTerminal())
|
||||
const windowSaved: WorkspaceSessionState = {
|
||||
|
||||
@@ -189,7 +189,13 @@ export function withClosedServeBrowserTab(
|
||||
const loaded = loadWorkspaceLayout(hostId, session, nameBasedLoadContext())
|
||||
const applied = applyLayoutCommand(
|
||||
loaded.layout,
|
||||
{ type: 'closeTabs', workspace: worktreeId, tabIds: [saved.tabId], force: true },
|
||||
{
|
||||
type: 'closeTabs',
|
||||
workspace: worktreeId,
|
||||
// Why (STA-11998): closeTabs takes the tab-bar id, which a window-saved tab keeps apart.
|
||||
tabIds: [savedBrowserTabEntryId(session, worktreeId, saved.tabId)],
|
||||
force: true
|
||||
},
|
||||
{ mintId: randomUUID, mintLeafId: randomUUID, now: Date.now }
|
||||
)
|
||||
if (!applied.ok) {
|
||||
|
||||
Reference in New Issue
Block a user