@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/src/router.ts
CHANGED
|
@@ -2130,9 +2130,18 @@ export class RouterCore<
|
|
|
2130
2130
|
loadedAt: Date.now(),
|
|
2131
2131
|
matches: newMatches,
|
|
2132
2132
|
pendingMatches: undefined,
|
|
2133
|
+
/**
|
|
2134
|
+
* When committing new matches, cache any exiting matches that are still usable.
|
|
2135
|
+
* Routes that resolved with `status: 'error'` or `status: 'notFound'` are
|
|
2136
|
+
* deliberately excluded from `cachedMatches` so that subsequent invalidations
|
|
2137
|
+
* or reloads re-run their loaders instead of reusing the failed/not-found data.
|
|
2138
|
+
*/
|
|
2133
2139
|
cachedMatches: [
|
|
2134
2140
|
...s.cachedMatches,
|
|
2135
|
-
...exitingMatches.filter(
|
|
2141
|
+
...exitingMatches.filter(
|
|
2142
|
+
(d) =>
|
|
2143
|
+
d.status !== 'error' && d.status !== 'notFound',
|
|
2144
|
+
),
|
|
2136
2145
|
],
|
|
2137
2146
|
}
|
|
2138
2147
|
})
|
|
@@ -2304,6 +2313,14 @@ export class RouterCore<
|
|
|
2304
2313
|
)
|
|
2305
2314
|
}
|
|
2306
2315
|
|
|
2316
|
+
/**
|
|
2317
|
+
* Invalidate the current matches and optionally force them back into a pending state.
|
|
2318
|
+
*
|
|
2319
|
+
* - Marks all matches that pass the optional `filter` as `invalid: true`.
|
|
2320
|
+
* - If `forcePending` is true, or a match is currently in `'error'` or `'notFound'` status,
|
|
2321
|
+
* its status is reset to `'pending'` and its `error` cleared so that the loader is re-run
|
|
2322
|
+
* on the next `load()` call (eg. after HMR or a manual invalidation).
|
|
2323
|
+
*/
|
|
2307
2324
|
invalidate: InvalidateFn<
|
|
2308
2325
|
RouterCore<
|
|
2309
2326
|
TRouteTree,
|
|
@@ -2318,7 +2335,9 @@ export class RouterCore<
|
|
|
2318
2335
|
return {
|
|
2319
2336
|
...d,
|
|
2320
2337
|
invalid: true,
|
|
2321
|
-
...(opts?.forcePending ||
|
|
2338
|
+
...(opts?.forcePending ||
|
|
2339
|
+
d.status === 'error' ||
|
|
2340
|
+
d.status === 'notFound'
|
|
2322
2341
|
? ({ status: 'pending', error: undefined } as const)
|
|
2323
2342
|
: undefined),
|
|
2324
2343
|
}
|