Record addressed acknowledgement deletions on row drops

This commit is contained in:
Brennan Benson
2026-11-13 23:18:10 -08:00
parent af3400b462
commit cd1e0ec73b
3 changed files with 8 additions and 1 deletions
@@ -346,6 +346,10 @@ it.each([100, 1000])(
}))
)
act(() => useAppStore.getState().acknowledgeAgents([other]))
act(() => useAppStore.getState().dropAgentStatus(other))
act(() => useAppStore.getState().setAgentStatuses([update(other, 'other')]))
act(() => useAppStore.getState().acknowledgeAgents([other]))
act(() => useAppStore.getState().dropAgentStatusByTabPrefix('tab-other'))
expect(rootReads()).toBe(0)
expect(commits).toBe(committed)
statusReads.mockRestore()
@@ -1,3 +1,4 @@
import { linkRecordWrite } from '../../keyed-record-transitions'
import type {
DropAgentStatusByTabPrefixOptions,
DropAgentStatusOptions
@@ -22,7 +23,7 @@ function removeAcknowledgement(
}
const next = { ...acknowledgements }
delete next[paneKey]
return next
return linkRecordWrite(next, acknowledgements, [paneKey])
}
export function createAgentStatusDropActions(
@@ -1,3 +1,4 @@
import { linkRecordWrite } from '../../keyed-record-transitions'
import type { AppState } from '../../types'
import type { DropAgentStatusByTabPrefixOptions } from './agent-status-contract'
import { pruneMigrationUnsupportedEntries } from './agent-status-migration-unsupported-entries'
@@ -67,6 +68,7 @@ export function buildAgentStatusTabPrefixDropPatch(
for (const k of ackKeys) {
delete nextAck[k]
}
linkRecordWrite(nextAck, s.acknowledgedAgentsByPaneKey, ackKeys)
}
const nextClosedTabs = opts?.paneKeys
? s.recentlyClosedAgentStatusTabIds