@tanstack/router-core 1.136.11 → 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.
- package/dist/cjs/router.cjs +10 -2
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +8 -0
- package/dist/esm/router.d.ts +8 -0
- package/dist/esm/router.js +10 -2
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +21 -2
package/dist/esm/router.d.ts
CHANGED
|
@@ -634,6 +634,14 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
|
|
|
634
634
|
startViewTransition: (fn: () => Promise<void>) => void;
|
|
635
635
|
updateMatch: UpdateMatchFn;
|
|
636
636
|
getMatch: GetMatchFn;
|
|
637
|
+
/**
|
|
638
|
+
* Invalidate the current matches and optionally force them back into a pending state.
|
|
639
|
+
*
|
|
640
|
+
* - Marks all matches that pass the optional `filter` as `invalid: true`.
|
|
641
|
+
* - If `forcePending` is true, or a match is currently in `'error'` or `'notFound'` status,
|
|
642
|
+
* its status is reset to `'pending'` and its `error` cleared so that the loader is re-run
|
|
643
|
+
* on the next `load()` call (eg. after HMR or a manual invalidation).
|
|
644
|
+
*/
|
|
637
645
|
invalidate: InvalidateFn<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
|
|
638
646
|
resolveRedirect: (redirect: AnyRedirect) => AnyRedirect;
|
|
639
647
|
clearCache: ClearCacheFn<this>;
|
package/dist/esm/router.js
CHANGED
|
@@ -652,9 +652,17 @@ class RouterCore {
|
|
|
652
652
|
loadedAt: Date.now(),
|
|
653
653
|
matches: newMatches,
|
|
654
654
|
pendingMatches: void 0,
|
|
655
|
+
/**
|
|
656
|
+
* When committing new matches, cache any exiting matches that are still usable.
|
|
657
|
+
* Routes that resolved with `status: 'error'` or `status: 'notFound'` are
|
|
658
|
+
* deliberately excluded from `cachedMatches` so that subsequent invalidations
|
|
659
|
+
* or reloads re-run their loaders instead of reusing the failed/not-found data.
|
|
660
|
+
*/
|
|
655
661
|
cachedMatches: [
|
|
656
662
|
...s.cachedMatches,
|
|
657
|
-
...exitingMatches.filter(
|
|
663
|
+
...exitingMatches.filter(
|
|
664
|
+
(d) => d.status !== "error" && d.status !== "notFound"
|
|
665
|
+
)
|
|
658
666
|
]
|
|
659
667
|
};
|
|
660
668
|
});
|
|
@@ -773,7 +781,7 @@ class RouterCore {
|
|
|
773
781
|
return {
|
|
774
782
|
...d,
|
|
775
783
|
invalid: true,
|
|
776
|
-
...opts?.forcePending || d.status === "error" ? { status: "pending", error: void 0 } : void 0
|
|
784
|
+
...opts?.forcePending || d.status === "error" || d.status === "notFound" ? { status: "pending", error: void 0 } : void 0
|
|
777
785
|
};
|
|
778
786
|
}
|
|
779
787
|
return d;
|