Repository navigation
hook syncfilterstosearchparams
Removed 2026-10-22 in the file-based router migration (PR #1447). The hook no longer exists in the codebase and must not be imported or imitated.
useSyncFiltersToSearchParams managed bidirectional synchronization between a filter state object and URL search parameters: on mount it hydrated filter state from the URL, and on every filter change it serialized state back into URL params (with { replace: true }), optionally through per-key transforms.
The hook merged from main shortly before the routing cutover, and the migration made it redundant rather than migrating it:
- The
/searchroute now owns its filter state through TanStack RoutervalidateSearch: validateWasteSearch— the URL is the single source of truth, validated by the Zod schema infrontend/src/routing/searchParams.ts. - Reading filters is
useSearchon the route; writing filters is a typed navigation that updates search params. There is no second React state to keep in sync, so a bidirectional sync hook has nothing to do. - Per-key transforms are unnecessary because the schema is the single place that decides how each parameter is typed, and the router-level
searchParamCodecwrites plain, human-readable URLs (strings unquoted, arrays comma-joined, booleanstrue/false).
Maintaining both mechanisms would mean two definitions of "what the URL means" — the hook was deleted in the same change instead.
| Old hook responsibility | New home |
|---|---|
| Hydrate filters from the URL |
/search route validateSearch + useWasteSearchFilters reading useSearch
|
| Serialize filters to the URL | Typed navigation writes; searchParamCodec in createAppRouter handles encoding |
| Lenient parsing (bad values degrade) | Zod schema .catch(undefined) per key — a malformed URL never fails the route |
| Legacy URL compatibility |
parseSearch JSON-decodes quoted/legacy values where needed |
- Routing — search state, the codec contract, and the request flow
- [File-Based Router Migration 20261022](File-Based Router Migration 20261022) — the change record with full reasoning
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository