0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/packages/router-core/tests
Flo a7504ae79e
refactor(router-core): simplify defaultParseSearch & defaultStringifySearch (#4985)
Wait for this PR before merging:
https://github.com/TanStack/router/pull/4987. It adds unit tests that
should help make sure we're not breaking anything here.

--- 

The functions used to serialize and deserialize search params are called
*a lot*, but they are creating many unnecessary objects. This PR
refactors
- `encode` to be only as generic as what we need => in practice we only
need to handle 1 value per key (i.e. `.set()` and not `.append()`) so we
don't need a special case for arrays
- `decode` can avoid creating many arrays
- `stringifySearchWith` (and `defaultStringifySearch`) don't need to
pre-stringify the input into a `<string,string>` dictionary as `encode`
now accepts a stringifier function


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- Breaking Changes
- Removed encode and decode from React Router and Solid Router public
exports.
  - Query string prefix support removed in encode/decode.
- Refactor
- Updated query string handling: arrays encode as comma-separated
values; duplicate keys decode into arrays.
- Streamlined error handling and avoided input mutation; consistent
leading “?” management.
- Tests
- Updated tests to match new encoding/decoding behavior and removed
prefix-related cases.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
History 2025-08-19 08:42:53 +02:00
..
json.test.ts fefactor: restructure SSR handling between start/router (#4495) 2025-06-26 22:14:57 +02:00
lru.test.ts refactor(router-core): add LRU cache in front of parsePathname (#4752) 2025-07-23 11:16:59 +02:00
match-by-path.test.ts test(router-core): add unit tests for matchByPath (#4749) 2025-07-23 11:58:09 +02:00
optional-path-params-clean.test.ts feat(router-core) path: parsePathname uses integers for Segment type (#4711) 2025-07-19 13:30:59 +02:00
optional-path-params.test.ts feat(router-core) path: parsePathname uses integers for Segment type (#4711) 2025-07-19 13:30:59 +02:00
path.test.ts feat(router-core) path: parsePathname uses integers for Segment type (#4711) 2025-07-19 13:30:59 +02:00
processRouteTree.test.ts fix(router-core): processRouteTree orders routes w/ prefix / suffix based on their lengths (#4850) 2025-08-01 19:30:52 +02:00
qss.test.ts refactor(router-core): simplify defaultParseSearch & defaultStringifySearch (#4985) 2025-08-19 08:42:53 +02:00
searchParams.test.ts test(router-core): add search param serialization / deserialization unit tests (#4987) 2025-08-19 08:16:58 +02:00
utils.test-d.ts fix: only call head() when loaderData is available (#3410) 2025-02-13 13:06:13 -07:00
utils.test.ts fix: handle Symbol properties and non-enumerable properties in replaceEqualDeep (#4237) 2025-05-24 11:01:44 +02:00