@tanstack/router-core 0.0.1-beta.201 → 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/cjs/router.js
CHANGED
|
@@ -1004,6 +1004,7 @@ class Router {
|
|
|
1004
1004
|
const fromPathname = dest.from ?? from.pathname;
|
|
1005
1005
|
let pathname = path.resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
|
|
1006
1006
|
const fromMatches = this.matchRoutes(fromPathname, from.search);
|
|
1007
|
+
const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
|
|
1007
1008
|
const prevParams = {
|
|
1008
1009
|
...utils.last(fromMatches)?.params
|
|
1009
1010
|
};
|
|
@@ -1017,8 +1018,8 @@ class Router {
|
|
|
1017
1018
|
});
|
|
1018
1019
|
}
|
|
1019
1020
|
pathname = path.interpolatePath(pathname, nextParams ?? {});
|
|
1020
|
-
const preSearchFilters =
|
|
1021
|
-
const postSearchFilters =
|
|
1021
|
+
const preSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
1022
|
+
const postSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
|
|
1022
1023
|
|
|
1023
1024
|
// Pre filters first
|
|
1024
1025
|
const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), from.search) : from.search;
|
|
@@ -1107,36 +1108,35 @@ class Router {
|
|
|
1107
1108
|
|
|
1108
1109
|
// If the next urls are the same and we're not replacing,
|
|
1109
1110
|
// do nothing
|
|
1110
|
-
if (isSameUrl
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
key: undefined
|
|
1111
|
+
if (!isSameUrl || next.replace) {
|
|
1112
|
+
let {
|
|
1113
|
+
maskedLocation,
|
|
1114
|
+
...nextHistory
|
|
1115
|
+
} = next;
|
|
1116
|
+
if (maskedLocation) {
|
|
1117
|
+
nextHistory = {
|
|
1118
|
+
...maskedLocation,
|
|
1119
|
+
state: {
|
|
1120
|
+
...maskedLocation.state,
|
|
1121
|
+
__tempKey: undefined,
|
|
1122
|
+
__tempLocation: {
|
|
1123
|
+
...nextHistory,
|
|
1124
|
+
search: nextHistory.searchStr,
|
|
1125
|
+
state: {
|
|
1126
|
+
...nextHistory.state,
|
|
1127
|
+
__tempKey: undefined,
|
|
1128
|
+
__tempLocation: undefined,
|
|
1129
|
+
key: undefined
|
|
1130
|
+
}
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
|
+
};
|
|
1134
|
+
if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
|
|
1135
|
+
nextHistory.state.__tempKey = this.tempLocationKey;
|
|
1133
1136
|
}
|
|
1134
|
-
};
|
|
1135
|
-
if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
|
|
1136
|
-
nextHistory.state.__tempKey = this.tempLocationKey;
|
|
1137
1137
|
}
|
|
1138
|
+
this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
|
|
1138
1139
|
}
|
|
1139
|
-
this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
|
|
1140
1140
|
this.resetNextScroll = next.resetScroll ?? true;
|
|
1141
1141
|
return this.latestLoadPromise;
|
|
1142
1142
|
};
|