* add router-core fixes and update tests
* update react-router unit tests
* update react-router e2e tests
* update solid-router unit tests
* update solid-router e2e tests
* update test description
* rename function
* rename test as per codeRabbit nitpick
* test cleanup
* add decode path segment util
* ensure navigation and browsing to path has same encoding/decoding
* add e2e tests
* add test recommendations
* nitpick
* minor enhancements
* build array once
* add additional unit and e2e tests
* remove react import from solid test
* nitpicks
* final nitpicks
* use history.push
resolves#5123 and adds checks to tests to ensure this runs as minimally
as possible
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Performance**
* Reuses existing route matches to reduce redundant param parsing and
stabilize navigation/loading behavior.
* **Tests**
* Updated tests to match the new postId param shape, navigation paths,
and parameter displays; added mocks to verify param parsing calls.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
with changing useParams to make use of _strictParams it became apparent
that _strictParams did not apply param parsing correctly. This PR
resolves that problem and hence useParams now return the parsed params
correctly.
This PR also adds unit tests in both react-router and solid-router to
test this expected result.
A separate PR has been created to merge into alpha (#5121)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Stricter route parameter parsing and validation with support for
custom parse/stringify.
- Clearer per-route parameter error reporting, with optional
throw-on-error behavior.
- More consistent parameter values across nested routes and loaders.
- Tests
- Added integration tests validating useParams with nested routing,
custom param parsing/stringifying, and loader data in both React and
Solid routers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Refactored a bit router options.Wrap and options.InnerWrap usage in
RouterProvider and Match components.
Now they will be able to provide context for their children components.
Added few tests for scenarios that were failing before.
Fixes#3744
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* New Features
* Consistent wrapper handling across routing so routed content and
pending states share the same wrapper/context without adding extra DOM
nodes.
* Exposed createMemoryHistory for memory-based routing in apps and
tests.
* Refactor
* Simplified suspense and wrapper handling for clearer, safer rendering
behavior.
* Tests
* Added tests verifying context propagation through wrappers and into
pending (fallback) states.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
When using relative routing we have 3 things to consider:
1) Is this relative to the current location? This is specifically
relevant for using `to="."` and `to=".."` in layout routes
2) Is this relative to the rendered route location?
3) Should this be relative to some other route in the tree
We have had a few issues where it hasn't been clear how relative routing
is applied in various scenarios, and where the application differs, for
example `to="."` and `to=".."` was treated differently.
This PR applies the following:
1) when no from path is specified, navigation is done from the current
location, this does not affect absolute paths but makes relative paths
more standardised.
2) other relative navigations require a from location to be specified.
This is achieved by setting Link and useNavigate to default to the
current active location instead of the rendered route location. This
also simplifies the logic in buildLocation as we no longer specifically
cater for `to="."`.
Included in this PR is the required changes to router-core
(buildLocation), react-router and solid-router (Link and useNavigate),
tests for both react-router and solid-router and an update to the docs
to clarify the usage.
This closes#4842
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added active-location hooks, origin-aware navigation helpers,
programmatic Route API for Link generation, browser-history utilities,
optional from origin for Navigate, and route fullPath exposure.
* **Bug Fixes**
* More deterministic relative navigation (., ..) resolution,
preservation of search/params, and runtime warnings for invalid origins.
* **Documentation**
* Clarified relative-link semantics and updated examples.
* **Tests**
* Vastly expanded end-to-end coverage for relative navigation, masking,
basepath, and trailing-slash permutations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
When we can (and it's reasonable), it's always beneficial to reduce the
number of objects we create in JS, so as to minimize the memory pressure
and the GC work.
`buildLocation` gets called pretty often, so removing a few object
allocations can be very beneficial (especially inside loops).
Also, from a purely "immediate performance" point of view,
`Object.assign` tends to be faster than `{...foo}`.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Refactor**
* Route parameter and search handling now use in-place updates to reduce
allocations and streamline iteration/control flow; behavior and public
API remain unchanged.
* **Tests**
* Updated tests to capture cloned parameter objects and assert on exact
values rather than relying on mock call history, preventing
mutation-related flakiness.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This PR *should* be a no-op. Just restructuring the code to have all the
functions used by `loadMatches` at the same level, instead of nested
callbacks. In order to still have access to the data that was previously
in scope because of nesting, we use a `innerLoadContext` object, which
is basically just the arguments of `loadMatches`, and a few mutables.
However, in order to do so, we have to rearrange promises in an area
that is sensitive to any microtask order change, and we did change some
of them. So this is not *really* a no-op, even though this does not
attempt any optimization.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Smoother navigations with predictable pending states and minimum
display durations.
- More consistent head/meta updates after route loading.
- Bug Fixes
- More reliable redirects and 404 handling, including during preloading
and SSR.
- Reduced UI flicker by refining pending and preloading behavior.
- Refactor
- Reworked the routing load pipeline for improved performance,
stability, and SSR behavior.
- Streamlined before-load steps for clearer, more consistent execution.
- Tests
- Updated tests to reflect the new loading flow.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Basically my understanding is that the `load` function gets called once
during SSR but right now our `Transitioner` calls it again as it appears
`createRenderEffect` run on the server too where as the `useEffect` in
React doesn't.
The fix is just to bail out if its running on the server. Feels kinda
hacky but it works.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Currently Route HeadContent don't have support to inline style tags.
After a contribution proposition made by @schiller-manuel in the Discord
Group I have decided to implement this.
I also have used this in the basic example for react-start and
solid-start and added style and style w/loader test cases to both
modules.
---------
Co-authored-by: Flo <fpellet@ensc.fr>