diff --git a/src/renderer/src/components/settings/workspace-cleanup/workspace-cleanup-activity-list.tsx b/src/renderer/src/components/settings/workspace-cleanup/workspace-cleanup-activity-list.tsx index d7a1a895df2..53f028c7cc5 100644 --- a/src/renderer/src/components/settings/workspace-cleanup/workspace-cleanup-activity-list.tsx +++ b/src/renderer/src/components/settings/workspace-cleanup/workspace-cleanup-activity-list.tsx @@ -72,9 +72,17 @@ export function WorkspaceCleanupActivityList({ run={run} open={toggled.get(run.id) ?? index === 0} onToggle={() => - setToggled((previous) => - new Map(previous).set(run.id, !(previous.get(run.id) ?? index === 0)) - ) + setToggled((previous) => { + // Carry only shown runs so ids that left the capped history drop out. + const next = new Map() + for (const { id } of runs) { + const value = previous.get(id) + if (value !== undefined) { + next.set(id, value) + } + } + return next.set(run.id, !(previous.get(run.id) ?? index === 0)) + }) } /> ))}