* 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
as part of #5169 we made changes to strip underscores from the paths to
ensure it is dealt with correctly during parsing.
inadvertently this stripped it from not only the route segments but also
the base segments. This PR resolves that issue by making
`baseParsePathName` aware which type of segments it is parsing.
a new optional boolean paramater, ```basePathValues```, is introduced in
`baseParsePathName` and `parsePathname` to allow this distinction
between routeSegments and/or basesegments to be passed on to
`baseParsePathName`.
2 new functions are introduced `parseBasePathSegments` and
`parseRoutePathSegments`, which is just wrapper functions around
`parsePathname`, but ensures clearer understanding of what set of
parsing instructions is applied and `basePathValues `is set correctly
based on the requirement.
updated the unit tests to take into account the need not to strip the
base values and also enhanced the e2e tests as well to ensure more
through testing with different usages.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Added non-nested route demos (named, prefix, suffix, path) with
index/foo/bar pages and updated navigation in React and Solid examples.
- Bug Fixes
- Improved path parsing/matching to handle non-nested segments,
prefixes/suffixes and trailing underscores; refined route
sorting/resolution.
- Tests
- Added comprehensive E2E coverage for non-nested paths; removed
obsolete baz-based tests.
- Expanded unit tests for path interpolation and matching (underscore,
prefix/suffix cases).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This PR continues on from #5165 and primarily adds additional tests to
path resolution and matchByPath for non-nested paths in additiona to e2e
test for both react and solid router to verify non-nesting
functionality.
One additional issue was picked up for handling of normal path segments.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Added non-nested demo routes and navigation examples (including
dynamic and edit paths) for React and Solid, with headings, links, and
parameter displays.
- Bug Fixes
- Improved path parsing/decoding for non-nested segments to prevent
unintended nesting and ensure correct parameter values.
- Tests
- Added broad unit tests for non-nested path parsing/matching/resolution
(case-sensitive/insensitive, wildcards, optional/fuzzy).
- Added e2e tests validating non-nested navigation and params; reduced
e2e flakiness by awaiting network idle.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
When parsing path params to interpolate the path non-nested path params
```/path/$param_``` was being parsed in the same manner as regular path
params ```/path/$param```.
This PR adds consideration for the trailing underscore when parsing the
path for non-nested path params as well as unit tests on path
interpolation and e2e tests for useParams to ensure this is parsed
correctly and updates correctly when params change.
This resolves#5164
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Support trailing-underscore non-nested path params (e.g., /users/$id_
→ /users/123).
- UI shows an additional navigation link for the non-nested route
(/params-ps/non-nested/foo2/bar2) and improved link display text.
- Tests
- Expanded React and Solid e2e tests to cover the new link, navigation,
and param parsing for foo2/bar2.
- Added unit tests validating interpolation/matching for the $param_
syntax.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This PR resolves#5133 by making the _strictParams more conscious of
path defining characters and other wildcards. It also adds e2e tests for
react and solid
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added “Non-nested path params” pages and links in React and Solid
basic-file-based e2e tests at /params-ps/non-nested, plus nested dynamic
routes to view single and combined params; UI links and outlets
included.
- **Bug Fixes**
- Improved internal path-parameter resolution so strict param extraction
uses the full route path for more accurate matching.
- **Tests**
- Added end-to-end tests verifying navigation to
/params-ps/non-nested/foo/bar and correct partial vs. full param values.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
#5020 highlighted an issue where when using useParams in parent route
(that has its own path param) with child routes that also use path
params this can cause excessive re-rendering of the parent route when
the params for the child routes changes.
The root cause for this is that the child params are available to the
parent route, even when strict=false was not specified and this also
does not match to the types that is being returned in this case. This
can be worked around by using select inside the useParams hook/function
but results in unnecessary boilerplate.
This PR attempts to resolve the issue by dealing with the two distinct
cases, one where we are only concerned about the path params of the
current route and prior routes (strict=true/undefined) and the second
where we want access in the parent route to the path params of the child
routes (strict=false).
In the strict case we use the match id to return the params of the
specific match, which is constant and results in stable rendering, while
in the strict=false case we fallback to the initial implementation of
returning params from the useMatch result which can be variable and
requires re-rendering to be done.
Changes were done on useParams for both react and solid, in solid's case
this wasn't causing re-renders but did return unexpected child params,
the change for solid is more toward keeping the API and expected outputs
consistent between the two frameworks. existing unit tests for react was
updated and e2e tests for both frameworks was added to ensure rendering
and results match the expected.
A separate merge has been prepared for Alpha and will be merged on
signoff of this one.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added nested named-parameter routes (three-level: foo → bar → baz) in
example apps with nested navigation, outlets, links and render-count
displays.
- Added a small render-counter component to visualize component
re-renders.
- **Bug Fixes**
- Improved params selection to respect strict vs non-strict modes,
reducing excess renders and producing stable param values.
- **Tests**
- Added E2E tests for React and Solid examples covering param navigation
and render-counts; expanded router unit tests for nested-route stability
and remount behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This is a follow-up to #4978.
As picked up by @Sheraff the changes made caused useNavigate to
negatively impact performance specifically with useNavigate being too
reactive to path changes.
This reverts the use of useActiveLocation, that acted as a single
implementation of the logic to determine the from location, and moves
the determination of the from path back to each of Link and useNavigate.
While the core logic is still the same across the implementations the
implication of how it's used and the sources of the required inputs are
different enough that it warrants separate implementations.
This PR does not revert the full change set and still applies to core
reasons and changes for the previous commit in keeping the logic for
determining the from clause the same, i.e. the order of determining the
from path for navigation remains: from clause => current location =>
rendered location.
@Sheraff to advise if this implementation resolves the issues he picked
up.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* Breaking Changes
* Removed active-location hooks and their associated types from React
and Solid packages.
* Refactor
* Link and navigation now accept an explicit "from" option instead of
deriving it from active-location state.
* New Features
* Added a programmatic Navigate helper for Solid to trigger navigation
on mount.
* Bug Fixes
* More predictable fallback behavior when no explicit "from" is
provided.
* Performance
* Reduced state subscriptions for minor efficiency gains.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
A lot of our e2e tests are querying external endpoints like
[typicode.com](https://jsonplaceholder.typicode.com) or
[example.com](https://example.com)
This is not ideal as it makes the e2e tests beholden to external factors
for example unavailability or rate limiting of these endpoints.
This PR addresses this by starting and stopping a local dummy server for
each test that needs to query external endpoints and mocks the results.
The setup and teardown have been implemented on each test package
individually so as to allow custom requirements where needed.
---------
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
The original `@tanstack/router-devtools` package still work - it's not
touch by this PR in any way, apart from a migration note saying:
>[@tanstack/router-devtools] Warning: This package has moved to
@tanstack/react-router-devtools. Please switch to the new package, as
this package will be dropped soon.
This introduce three new packages
- @tanstack/router-devtools-core : This is a SolidJS port of the UI
And two adapters on top, that mount this solid app and forward
router/routerState into it.
- @tanstack/solid-router-devtools
- @tanstack/router-router-devtools
For use of devtools in production, a `TanStackRouterDevtoolsInProd` can
be imported instead of the standard `TanStackRouterDevtools` that'll be
tree shaken away in prod.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
Picking solid-router relevant changes from
[commit](https://github.com/TanStack/router/pull/3522/commits/9eaa09ea1f95f786e9bd239fe787f10d6cb08e1c)
by @brenelz , that fixes assets handler in solid-router by using
`@solidjs/meta`.
With this, the head tags like the title will update on client
navigation.
The changes in this PR that affect most files are merely repetitions of:
- bumping solid 1.9.4 -> 1.9.5
- inserting `<HeadContent>` in the root route
- removing `<title>` from the index.html
Includes an automated test for solid-router corresponding to
- https://github.com/TanStack/router/pull/3610
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* copy react-router
* update
* Move forward branch
* cleanup
* cleanup
* add publish
* bump deps
* ci: apply automated fixes
* remove unused imports
* ci: apply automated fixes
* bump vite plugin solid
* fix imports
* ci: apply automated fixes
* remove react lint from solid-router
* fix types
* ci: apply automated fixes
* add structuralSharing
* downgrade vite plugin solid
* fix scroll-restoration in solid-router
* fix Transitioner
* fix imports from ScrollRestoration
* Fix tests
* Fix more tests
* Remove the react $$typeof
* add accessors to useLocation
* add remountDeps
* cleanup
* remove tanstack/store
* format
* add missing call to setupScrollRestoration
* format
* add optional
* align match component
* make matches a signal
* Bump vite-plugin-solid to stable
* add missing await
* Fix unknown error
* Tweak the tests to call functions
* remove unused vars
* fix lockfile
* Down to 25 failures
* Remove .only
* call search()
* remove the structuralSharing
* fix type test
* fix structuralSharing
* comment out structured sharing validation check
* fix typings
* comment out serialization check
* comment out serialization check
* cleanup
* improve types of useSearch
* fix "when setting search params with 2 parallel navigate calls"
* fix useParams
* fix types
* fix useParams types
* cleanup debug
* fix link data loader
* fix data loader signal
* fix type test
* fix Link "when navigating away from a route with a loader that errors"
* setup on() simpler
* make initial load a createRenderEffect
* Fix some link preload tests
* add accessor to UseMatchRoute
* fix: when navigating to /posts with a beforeLoad that returns context
* call parentRouteId
* re-enable invariant
* fix when navigating from /invoices to ./invoiceId and the current route is /posts/$postId/details
* use memo for prev
* remove browserhistory workaround
* fix "after a navigation, should have emitted the "onResolved" event twice"
* skip remount
* add types to useSearch
* fix search middleware
* don't need a getter
* sync react-router
* solid kitchen sink
* add the example to workspace
* lockfile
* fix solid kitchensink name
* add solid template
* fix example
* rename react to solid
* work on example
* add accessor
* fix type tests
* Fix login in example
* Don't destructure
* Fix stuck on pending component
* Fix where loaderData can be undefined
* Use For component
* More refactor
* Hacky way to fix loading spinner
* Fix one test
* Better MatchRoute fix
* Down to 1 failing test
* Fix last test
* cleanup subscription
* lockfile
* eslint
* ci: apply automated fixes
* fix router-core lint
* ci: apply automated fixes
* add e2e test for solid-router
* ci: apply automated fixes
* work on solid-router e2e suites
* fix comment
* use solid-virtualizer
* work on scroll-restauration
* work on scroll-restauration
* skip react-specific useRenderEffect test
* fix errorcomponent being used before it's defined
* set solid target for esbuild
* ci: apply automated fixes
* fix rspack tests
* fix query tets
* add solid-query example
* use memo for post
* add memo for posts
* fix example
* add jsx compiler flags to esbuild commands
* add esbuild-plugin-solid
* Fix some e2e
* ci: apply automated fixes
* port #3423 from react-router
* fix useLoaderData test-d
* add codeSplitGroupings
* Scroll restoration fixes
* add asset headcontent script
* remove solid-router-copy
* fix react use
* fix scroll restoration test
* skip esbuild because it's broken in react-router
* wait for timeout
* update scroll-restoration to match react
* useLocation
* use on() in match
* align useNavigate with react-router
* lockfile
* fix Scripts test
* align __TSR_SSR__ in ScriptOnce
* remove solid-router from publish
* lint
* ci: apply automated fixes
* align to react-router
* port over "exclude props from state equality check to prevent history push for equal url and state"
* align with react-router
* add shouldThrow
* fix typePrimitives
* use searchStr to fix the search middleware
* ci: add solid-router to the labeler
* use patched vite-plugin-solid
* eslint
* ci: apply automated fixes
* use vite-plugin-solid 2.11.2
* remove only modifier
* move vite-plugin-solid peerDep to router-plugin
* use latest vite-plugin-solid
* move vitest to root
* bump vitest
* revert onRendered
* lint
* add to publish
* fix scroll restoration
* ci: apply automated fixes
* align version with react-router
* sync to react-router
* sync with react-router
* sync navigate tests to react-router
* ci: apply automated fixes
* use Solid.JSX.Element consistently instead of Solid.JSXElement
* remove irrelevant test
* ci: apply automated fixes
* remove unused suite
* lint
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Brenley Dueck <brenleydueck@gmail.com>
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>