@tanstack/router-core 1.136.9 → 1.136.13

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.
@@ -654,9 +654,17 @@ class RouterCore {
654
654
  loadedAt: Date.now(),
655
655
  matches: newMatches,
656
656
  pendingMatches: void 0,
657
+ /**
658
+ * When committing new matches, cache any exiting matches that are still usable.
659
+ * Routes that resolved with `status: 'error'` or `status: 'notFound'` are
660
+ * deliberately excluded from `cachedMatches` so that subsequent invalidations
661
+ * or reloads re-run their loaders instead of reusing the failed/not-found data.
662
+ */
657
663
  cachedMatches: [
658
664
  ...s.cachedMatches,
659
- ...exitingMatches.filter((d) => d.status !== "error")
665
+ ...exitingMatches.filter(
666
+ (d) => d.status !== "error" && d.status !== "notFound"
667
+ )
660
668
  ]
661
669
  };
662
670
  });
@@ -775,7 +783,7 @@ class RouterCore {
775
783
  return {
776
784
  ...d,
777
785
  invalid: true,
778
- ...opts?.forcePending || d.status === "error" ? { status: "pending", error: void 0 } : void 0
786
+ ...opts?.forcePending || d.status === "error" || d.status === "notFound" ? { status: "pending", error: void 0 } : void 0
779
787
  };
780
788
  }
781
789
  return d;