From abc9d6f3af8d95fde5829dfc066828d7876ab64f Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 23 Aug 2026 15:10:22 -0700 Subject: [PATCH] chore(workspace-cleanup): tighten hydration guard rationale --- .../slices/ui-hydration-workspace-cleanup-browse.test.ts | 4 +--- src/renderer/src/store/slices/ui.ts | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/store/slices/ui-hydration-workspace-cleanup-browse.test.ts b/src/renderer/src/store/slices/ui-hydration-workspace-cleanup-browse.test.ts index c91e4e0d803..326bc002362 100644 --- a/src/renderer/src/store/slices/ui-hydration-workspace-cleanup-browse.test.ts +++ b/src/renderer/src/store/slices/ui-hydration-workspace-cleanup-browse.test.ts @@ -18,9 +18,7 @@ describe('workspace cleanup browse hydration', () => { }) it('does not let a sync broadcast revert a filter the user just set', () => { - // The browse writer debounces 250ms, so any other ui.set inside that window - // broadcasts state that still holds the previous filters. Re-hydrating it here - // reverted the edit, and the pending debounce then persisted the revert. + // Other ui.set broadcasts carry stale browse state until its debounced writer runs. const store = createUIStore() store.getState().hydratePersistedUI(persistedWithIdleDays(30), 'startup') diff --git a/src/renderer/src/store/slices/ui.ts b/src/renderer/src/store/slices/ui.ts index 7165119e6f0..616f0a92467 100644 --- a/src/renderer/src/store/slices/ui.ts +++ b/src/renderer/src/store/slices/ui.ts @@ -2625,11 +2625,7 @@ export const createUISlice: StateCreator = (set, get) // Why the normalizer rather than a cast: this blob is hand-editable and // may come from an older or newer build; it degrades field by field // instead of bricking the cleanup dialog. - // Why startup-only, like activeView below: the browse writer debounces 250ms, so - // any other ui.set inside that window broadcasts state still holding the previous - // filters. Re-hydrating it here reverted the edit, and the pending debounce then - // persisted the revert. Nothing else edits browse state (mobile has no cleanup - // consumer, the popout is a separate store), so filters are per-window. + // Why: a sync broadcast can carry stale browse state while its writer is debounced. workspaceCleanupBrowse: source === 'startup' ? normalizeWorkspaceCleanupBrowseState(ui.workspaceCleanup?.browse)