From 55b0e615bf20463d3f89a6e2fea135d84879ea80 Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:54:50 +0000 Subject: [PATCH] fix(settings): preview again on every cleanup confirm A workspace can age past a rule while the confirm is open, so the confirm always checks again and lists anything new before saving. --- .../WorkspaceCleanupSettingsPane.tsx | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/renderer/src/components/settings/workspace-cleanup/WorkspaceCleanupSettingsPane.tsx b/src/renderer/src/components/settings/workspace-cleanup/WorkspaceCleanupSettingsPane.tsx index bf81e851c05..1d4439612ae 100644 --- a/src/renderer/src/components/settings/workspace-cleanup/WorkspaceCleanupSettingsPane.tsx +++ b/src/renderer/src/components/settings/workspace-cleanup/WorkspaceCleanupSettingsPane.tsx @@ -84,11 +84,7 @@ function summarizeMatches( type RulesChange = (rules: WorkspaceCleanupRules) => WorkspaceCleanupRules -type PendingChange = WorkspaceCleanupRuleChangeRequest & { - change: RulesChange - /** The host's rules the listed rows were previewed against. */ - previewedRules: string -} +type PendingChange = WorkspaceCleanupRuleChangeRequest & { change: RulesChange } export function WorkspaceCleanupSettingsPane({ hostScope, @@ -206,7 +202,7 @@ export function WorkspaceCleanupSettingsPane({ } if (request && rows.length > 0) { setPendingRule(null) - setPendingChange({ ...request, rows, change, previewedRules: JSON.stringify(latest) }) + setPendingChange({ ...request, rows, change }) return } finishChange(await update(nextRules)) @@ -253,21 +249,19 @@ export function WorkspaceCleanupSettingsPane({ if (!change) { return } - // The dialog can stay open a while; if the rules moved, what it lists may no longer be all. + // The dialog can stay open a while: the rules may have moved, or a workspace aged past a rule. const latest = await readLatest() if (!latest || !mountedRef.current) { return } - if (JSON.stringify(latest) !== change.previewedRules) { - const rows = await previewNewRemovals(latest, change.change(latest)) - if (!rows || !mountedRef.current) { - return - } - const listed = new Set(change.rows.map(workspaceCleanupRowKey)) - if (rows.some((row) => !listed.has(workspaceCleanupRowKey(row)))) { - setPendingChange({ ...change, rows, previewedRules: JSON.stringify(latest) }) - return - } + const rows = await previewNewRemovals(latest, change.change(latest)) + if (!rows || !mountedRef.current) { + return + } + const listed = new Set(change.rows.map(workspaceCleanupRowKey)) + if (rows.some((row) => !listed.has(workspaceCleanupRowKey(row)))) { + setPendingChange({ ...change, rows }) + return } // Pinned workspaces are always kept, so Keep is a pin rather than a second keep list. for (const row of keep) {