fix: preserve plugin dialogs and isolate event delivery

This commit is contained in:
Nwflower committed 2026-12-03 02:07:43 -07:00
1 parent 36486a0850
commit fe0c014e60
3 files changed
+15 -6

No files matched your search

+4 -2
View File
@@ -330,10 +330,12 @@ test('closing a page retries cleanup of a late task after rate limiting', async
assert.equal(attempts, 2)
})
test('pruning removes a view and dialogs when their conditions stop matching', () => {
test('pruning removes an unavailable page but keeps open dialogs until their VM disappears', () => {
const page = { pluginId: 'demo', viewId: 'vm', location: 'vm.tab', vm: 'vm-1' }
const dialog = { ...page, viewId: 'dialog', location: 'dialog' }
let state = openPluginView(emptyPluginViewState, page)
state = openPluginView(state, dialog)
assert.deepEqual(prunePluginViews(state, new Set(['demo/vm', 'demo/dialog']), () => true, () => false), emptyPluginViewState)
const views = new Set(['demo/vm', 'demo/dialog'])
assert.deepEqual(prunePluginViews(state, views, () => true, () => false), { ...emptyPluginViewState, dialogs: [dialog] })
assert.deepEqual(prunePluginViews(state, views, () => false), emptyPluginViewState)
})