@tanstack/router-core 0.0.1-beta.202 → 0.0.1-beta.203
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 +27 -27
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +27 -27
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +124 -124
- package/build/umd/index.development.js +27 -27
- 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 +36 -31
package/build/esm/index.js
CHANGED
|
@@ -1499,6 +1499,7 @@ class Router {
|
|
|
1499
1499
|
const fromPathname = dest.from ?? from.pathname;
|
|
1500
1500
|
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
|
|
1501
1501
|
const fromMatches = this.matchRoutes(fromPathname, from.search);
|
|
1502
|
+
const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
|
|
1502
1503
|
const prevParams = {
|
|
1503
1504
|
...last(fromMatches)?.params
|
|
1504
1505
|
};
|
|
@@ -1512,8 +1513,8 @@ class Router {
|
|
|
1512
1513
|
});
|
|
1513
1514
|
}
|
|
1514
1515
|
pathname = interpolatePath(pathname, nextParams ?? {});
|
|
1515
|
-
const preSearchFilters =
|
|
1516
|
-
const postSearchFilters =
|
|
1516
|
+
const preSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
1517
|
+
const postSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
1517
1518
|
|
|
1518
1519
|
// Pre filters first
|
|
1519
1520
|
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), from.search) : from.search;
|
|
@@ -1602,36 +1603,35 @@ class Router {
|
|
|
1602
1603
|
|
|
1603
1604
|
// If the next urls are the same and we're not replacing,
|
|
1604
1605
|
// do nothing
|
|
1605
|
-
if (isSameUrl
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
key: undefined
|
|
1606
|
+
if (!isSameUrl || next.replace) {
|
|
1607
|
+
let {
|
|
1608
|
+
maskedLocation,
|
|
1609
|
+
...nextHistory
|
|
1610
|
+
} = next;
|
|
1611
|
+
if (maskedLocation) {
|
|
1612
|
+
nextHistory = {
|
|
1613
|
+
...maskedLocation,
|
|
1614
|
+
state: {
|
|
1615
|
+
...maskedLocation.state,
|
|
1616
|
+
__tempKey: undefined,
|
|
1617
|
+
__tempLocation: {
|
|
1618
|
+
...nextHistory,
|
|
1619
|
+
search: nextHistory.searchStr,
|
|
1620
|
+
state: {
|
|
1621
|
+
...nextHistory.state,
|
|
1622
|
+
__tempKey: undefined,
|
|
1623
|
+
__tempLocation: undefined,
|
|
1624
|
+
key: undefined
|
|
1625
|
+
}
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
|
+
};
|
|
1629
|
+
if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
|
|
1630
|
+
nextHistory.state.__tempKey = this.tempLocationKey;
|
|
1628
1631
|
}
|
|
1629
|
-
};
|
|
1630
|
-
if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
|
|
1631
|
-
nextHistory.state.__tempKey = this.tempLocationKey;
|
|
1632
1632
|
}
|
|
1633
|
+
this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
|
|
1633
1634
|
}
|
|
1634
|
-
this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
|
|
1635
1635
|
this.resetNextScroll = next.resetScroll ?? true;
|
|
1636
1636
|
return this.latestLoadPromise;
|
|
1637
1637
|
};
|