ArtAssetLibrary filterState clobbered by URL effect before router.navigate settles #1026

Closed
opened 2026-08-12 09:02:46 +00:00 by spikerj · 1 comment
Owner

Bug

ArtAssetLibraryComponent.applyFilter sets filterState then void this.router.navigate(...). The constructor effect reads both queryParamMap() and filterState(). When filterState updates, the effect re-runs while queryParamMap is still stale, sees a mismatch, and writes the old URL filter back into filterState — wiping the just-typed search / chip change until navigation completes.

Where

libraries/features/art-studio/src/lib/art-asset-library/art-asset-library.component.ts — applyFilter + the URL sync effect in the constructor.

Would catch

Typing in the library search (or toggling a chip) then flushing CD/effects before the router emits new query params leaves gridFilter().search empty and the grid unfiltered.

Suggested fix

Ignore URL→state sync while a local write is in flight (generation token / skip-echo flag), or only sync from URL when queryParamMap itself changed (not when filterState changed).

## Bug `ArtAssetLibraryComponent.applyFilter` sets `filterState` then `void this.router.navigate(...)`. The constructor `effect` reads both `queryParamMap()` and `filterState()`. When `filterState` updates, the effect re-runs while `queryParamMap` is still stale, sees a mismatch, and **writes the old URL filter back into `filterState`** — wiping the just-typed search / chip change until navigation completes. ## Where `libraries/features/art-studio/src/lib/art-asset-library/art-asset-library.component.ts` — `applyFilter` + the URL sync `effect` in the constructor. ## Would catch Typing in the library search (or toggling a chip) then flushing CD/effects before the router emits new query params leaves `gridFilter().search` empty and the grid unfiltered. ## Suggested fix Ignore URL→state sync while a local write is in flight (generation token / skip-echo flag), or only sync from URL when `queryParamMap` itself changed (not when `filterState` changed).
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). ArtAssetLibrary filterState is not clobbered by the URL effect before navigate settles. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). ArtAssetLibrary filterState is not clobbered by the URL effect before navigate settles. Closing.
Sign in to join this conversation.