@tanstack/react-router 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/RouterProvider.js +1 -1
- package/build/cjs/RouterProvider.js.map +1 -1
- package/build/cjs/router.js +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +355 -355
- package/build/umd/index.development.js +2 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/RouterProvider.tsx +1 -1
- package/src/router.ts +2 -2
|
@@ -1229,7 +1229,7 @@
|
|
|
1229
1229
|
function useRouter(opts) {
|
|
1230
1230
|
const resolvedContext = typeof document !== 'undefined' ? window.__TSR_ROUTER_CONTEXT__ || exports.routerContext : exports.routerContext;
|
|
1231
1231
|
const value = React__namespace.useContext(resolvedContext);
|
|
1232
|
-
warning(opts?.warn && value, 'useRouter must be used inside a <RouterProvider> component!');
|
|
1232
|
+
warning(!((opts?.warn ?? true) && !value), 'useRouter must be used inside a <RouterProvider> component!');
|
|
1233
1233
|
return value;
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
@@ -2474,7 +2474,7 @@
|
|
|
2474
2474
|
buildLocation = opts => {
|
|
2475
2475
|
const build = (dest = {}, matches) => {
|
|
2476
2476
|
const from = this.latestLocation;
|
|
2477
|
-
const fromSearch = (this.state.pendingMatches || this.state.matches).
|
|
2477
|
+
const fromSearch = (this.state.pendingMatches || this.state.matches).reverse()[0]?.search || from.search;
|
|
2478
2478
|
let pathname = this.resolvePathWithBase(from.pathname, `${dest.to ?? ''}`);
|
|
2479
2479
|
const fromMatches = this.matchRoutes(from.pathname, fromSearch);
|
|
2480
2480
|
const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
|