@tanstack/router-core 1.154.3 → 1.154.4
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/dist/cjs/router.cjs +15 -7
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +5 -0
- package/dist/esm/router.d.ts +5 -0
- package/dist/esm/router.js +15 -7
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +24 -8
package/dist/cjs/router.cjs
CHANGED
|
@@ -250,9 +250,9 @@ class RouterCore {
|
|
|
250
250
|
search: locationSearchOrOpts
|
|
251
251
|
},
|
|
252
252
|
opts
|
|
253
|
-
);
|
|
253
|
+
).matches;
|
|
254
254
|
}
|
|
255
|
-
return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts);
|
|
255
|
+
return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts).matches;
|
|
256
256
|
};
|
|
257
257
|
this.getMatchedRoutes = (pathname) => {
|
|
258
258
|
return getMatchedRoutes({
|
|
@@ -316,9 +316,10 @@ class RouterCore {
|
|
|
316
316
|
path: nextTo,
|
|
317
317
|
params: nextParams
|
|
318
318
|
}).interpolatedPath;
|
|
319
|
-
const destMatches = this.
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
const { matches: destMatches, rawParams } = this.matchRoutesInternal(
|
|
320
|
+
{ pathname: interpolatedNextTo },
|
|
321
|
+
{ _buildLocation: true }
|
|
322
|
+
);
|
|
322
323
|
const destRoutes = destMatches.map(
|
|
323
324
|
(d) => this.looseRoutesById[d.routeId]
|
|
324
325
|
);
|
|
@@ -373,9 +374,13 @@ class RouterCore {
|
|
|
373
374
|
const hashStr = hash ? `#${hash}` : "";
|
|
374
375
|
let nextState = dest.state === true ? currentLocation.state : dest.state ? utils.functionalUpdate(dest.state, currentLocation.state) : {};
|
|
375
376
|
nextState = utils.replaceEqualDeep(currentLocation.state, nextState);
|
|
377
|
+
const snapshotParams = {
|
|
378
|
+
...rawParams,
|
|
379
|
+
...nextParams
|
|
380
|
+
};
|
|
376
381
|
const matchSnapshot = buildMatchSnapshotFromRoutes({
|
|
377
382
|
routes: destRoutes,
|
|
378
|
-
params:
|
|
383
|
+
params: snapshotParams,
|
|
379
384
|
searchStr,
|
|
380
385
|
globalNotFoundRouteId: globalNotFoundMatch?.routeId
|
|
381
386
|
});
|
|
@@ -1071,17 +1076,20 @@ class RouterCore {
|
|
|
1071
1076
|
const snapshotValid = snapshot && snapshot.routeIds.length > 0 && snapshot.routeIds.every((id) => this.routesById[id]);
|
|
1072
1077
|
let matchedRoutes;
|
|
1073
1078
|
let routeParams;
|
|
1079
|
+
let rawParams;
|
|
1074
1080
|
let globalNotFoundRouteId;
|
|
1075
1081
|
let parsedParams;
|
|
1076
1082
|
if (snapshotValid) {
|
|
1077
1083
|
matchedRoutes = snapshot.routeIds.map((id) => this.routesById[id]);
|
|
1078
1084
|
routeParams = { ...snapshot.params };
|
|
1085
|
+
rawParams = { ...snapshot.params };
|
|
1079
1086
|
globalNotFoundRouteId = snapshot.globalNotFoundRouteId;
|
|
1080
1087
|
parsedParams = snapshot.parsedParams;
|
|
1081
1088
|
} else {
|
|
1082
1089
|
const matchedRoutesResult = this.getMatchedRoutes(next.pathname);
|
|
1083
1090
|
const { foundRoute, routeParams: rp } = matchedRoutesResult;
|
|
1084
1091
|
routeParams = rp;
|
|
1092
|
+
rawParams = { ...rp };
|
|
1085
1093
|
matchedRoutes = matchedRoutesResult.matchedRoutes;
|
|
1086
1094
|
parsedParams = matchedRoutesResult.parsedParams;
|
|
1087
1095
|
let isGlobalNotFound = false;
|
|
@@ -1307,7 +1315,7 @@ class RouterCore {
|
|
|
1307
1315
|
};
|
|
1308
1316
|
}
|
|
1309
1317
|
});
|
|
1310
|
-
return matches;
|
|
1318
|
+
return { matches, rawParams };
|
|
1311
1319
|
}
|
|
1312
1320
|
}
|
|
1313
1321
|
class SearchParamError extends Error {
|