chore(workspace-cleanup): tighten hydration guard rationale

This commit is contained in:
Brennan Benson
2026-08-23 15:10:22 -07:00
parent 006374d98b
commit abc9d6f3af
2 changed files with 2 additions and 8 deletions
@@ -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')
+1 -5
View File
@@ -2625,11 +2625,7 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (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)