@tanstack/react-router 0.0.1-beta.254 → 0.0.1-beta.256
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/router.js +4 -3
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/useNavigate.js +1 -2
- package/build/cjs/useNavigate.js.map +1 -1
- package/build/esm/index.js +5 -4
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +355 -361
- package/build/umd/index.development.js +5 -4
- 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/router.ts +7 -4
- package/src/useNavigate.tsx +1 -1
|
@@ -2224,9 +2224,10 @@
|
|
|
2224
2224
|
buildLocation = opts => {
|
|
2225
2225
|
const build = (dest = {}, matches) => {
|
|
2226
2226
|
const from = this.latestLocation;
|
|
2227
|
+
const fromSearch = (this.state.pendingMatches || this.state.matches).at(-1)?.search || from.search;
|
|
2227
2228
|
const fromPathname = dest.from ?? from.pathname;
|
|
2228
2229
|
let pathname = this.resolvePathWithBase(fromPathname, `${dest.to ?? ''}`);
|
|
2229
|
-
const fromMatches = this.matchRoutes(fromPathname,
|
|
2230
|
+
const fromMatches = this.matchRoutes(fromPathname, fromSearch);
|
|
2230
2231
|
const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
|
|
2231
2232
|
const prevParams = {
|
|
2232
2233
|
...last(fromMatches)?.params
|
|
@@ -2245,7 +2246,7 @@
|
|
|
2245
2246
|
const postSearchFilters = stayingMatches?.map(match => this.looseRoutesById[match.routeId].options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
2246
2247
|
|
|
2247
2248
|
// Pre filters first
|
|
2248
|
-
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev),
|
|
2249
|
+
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), fromSearch) : fromSearch;
|
|
2249
2250
|
|
|
2250
2251
|
// Then the link/navigate function
|
|
2251
2252
|
const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
|
|
@@ -2255,7 +2256,7 @@
|
|
|
2255
2256
|
|
|
2256
2257
|
// Then post filters
|
|
2257
2258
|
const postFilteredSearch = postSearchFilters?.length ? postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
|
|
2258
|
-
const search = replaceEqualDeep(
|
|
2259
|
+
const search = replaceEqualDeep(fromSearch, postFilteredSearch);
|
|
2259
2260
|
const searchStr = this.options.stringifySearch(search);
|
|
2260
2261
|
const hash = dest.hash === true ? from.hash : dest.hash ? functionalUpdate(dest.hash, from.hash) : from.hash;
|
|
2261
2262
|
const hashStr = hash ? `#${hash}` : '';
|
|
@@ -3185,7 +3186,7 @@
|
|
|
3185
3186
|
const match = useMatch({
|
|
3186
3187
|
strict: false
|
|
3187
3188
|
});
|
|
3188
|
-
|
|
3189
|
+
React__namespace.useEffect(() => {
|
|
3189
3190
|
navigate({
|
|
3190
3191
|
from: props.to ? match.pathname : undefined,
|
|
3191
3192
|
...props
|