@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.
@@ -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,