@tanstack/router-core 1.139.1 → 1.139.5
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 +19 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/ssr/ssr-client.cjs +8 -0
- package/dist/cjs/ssr/ssr-client.cjs.map +1 -1
- package/dist/esm/router.js +19 -1
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/ssr/ssr-client.js +8 -0
- package/dist/esm/ssr/ssr-client.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +22 -1
- package/src/ssr/ssr-client.ts +8 -0
package/dist/cjs/router.cjs
CHANGED
|
@@ -528,7 +528,7 @@ class RouterCore {
|
|
|
528
528
|
});
|
|
529
529
|
return commitPromise;
|
|
530
530
|
};
|
|
531
|
-
this.navigate = ({ to, reloadDocument, href, ...rest }) => {
|
|
531
|
+
this.navigate = async ({ to, reloadDocument, href, ...rest }) => {
|
|
532
532
|
if (!reloadDocument && href) {
|
|
533
533
|
try {
|
|
534
534
|
new URL(`${href}`);
|
|
@@ -541,6 +541,23 @@ class RouterCore {
|
|
|
541
541
|
const location = this.buildLocation({ to, ...rest });
|
|
542
542
|
href = location.url;
|
|
543
543
|
}
|
|
544
|
+
if (!rest.ignoreBlocker) {
|
|
545
|
+
const historyWithBlockers = this.history;
|
|
546
|
+
const blockers = historyWithBlockers.getBlockers?.() ?? [];
|
|
547
|
+
for (const blocker of blockers) {
|
|
548
|
+
if (blocker?.blockerFn) {
|
|
549
|
+
const shouldBlock = await blocker.blockerFn({
|
|
550
|
+
currentLocation: this.latestLocation,
|
|
551
|
+
nextLocation: this.latestLocation,
|
|
552
|
+
// External URLs don't have a next location in our router
|
|
553
|
+
action: "PUSH"
|
|
554
|
+
});
|
|
555
|
+
if (shouldBlock) {
|
|
556
|
+
return Promise.resolve();
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
544
561
|
if (rest.replace) {
|
|
545
562
|
window.location.replace(href);
|
|
546
563
|
} else {
|
|
@@ -1097,6 +1114,7 @@ class RouterCore {
|
|
|
1097
1114
|
const status = route.options.loader || route.options.beforeLoad || route.lazyFn || loadMatches.routeNeedsPreload(route) ? "pending" : "success";
|
|
1098
1115
|
match = {
|
|
1099
1116
|
id: matchId,
|
|
1117
|
+
ssr: this.isServer ? void 0 : route.options.ssr,
|
|
1100
1118
|
index,
|
|
1101
1119
|
routeId: route.id,
|
|
1102
1120
|
params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|