@tanstack/react-router 1.77.0 → 1.77.2
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 +3 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +5 -5
- package/dist/esm/router.d.ts +5 -5
- package/dist/esm/router.js +3 -1
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +9 -6
package/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -70,6 +70,7 @@ import type {
|
|
|
70
70
|
import type {
|
|
71
71
|
AnyRouteMatch,
|
|
72
72
|
MakeRouteMatch,
|
|
73
|
+
MakeRouteMatchUnion,
|
|
73
74
|
MatchRouteOptions,
|
|
74
75
|
} from './Matches'
|
|
75
76
|
import type { ParsedLocation } from './location'
|
|
@@ -2553,11 +2554,11 @@ export class Router<
|
|
|
2553
2554
|
return matches
|
|
2554
2555
|
}
|
|
2555
2556
|
|
|
2556
|
-
invalidate = (opts?: {
|
|
2557
|
-
filter?: (d:
|
|
2557
|
+
invalidate = <TRouter extends AnyRouter = RegisteredRouter>(opts?: {
|
|
2558
|
+
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean
|
|
2558
2559
|
}) => {
|
|
2559
2560
|
const invalidate = (d: MakeRouteMatch<TRouteTree>) => {
|
|
2560
|
-
if (opts?.filter?.(d) ?? true) {
|
|
2561
|
+
if (opts?.filter?.(d as MakeRouteMatchUnion<TRouter>) ?? true) {
|
|
2561
2562
|
return {
|
|
2562
2563
|
...d,
|
|
2563
2564
|
invalid: true,
|
|
@@ -2589,15 +2590,17 @@ export class Router<
|
|
|
2589
2590
|
return redirect
|
|
2590
2591
|
}
|
|
2591
2592
|
|
|
2592
|
-
clearCache = (opts?: {
|
|
2593
|
-
filter?: (d:
|
|
2593
|
+
clearCache = <TRouter extends AnyRouter = RegisteredRouter>(opts?: {
|
|
2594
|
+
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean
|
|
2594
2595
|
}) => {
|
|
2595
2596
|
const filter = opts?.filter
|
|
2596
2597
|
if (filter !== undefined) {
|
|
2597
2598
|
this.__store.setState((s) => {
|
|
2598
2599
|
return {
|
|
2599
2600
|
...s,
|
|
2600
|
-
cachedMatches: s.cachedMatches.filter(
|
|
2601
|
+
cachedMatches: s.cachedMatches.filter(
|
|
2602
|
+
(m) => !filter(m as MakeRouteMatchUnion<TRouter>),
|
|
2603
|
+
),
|
|
2601
2604
|
}
|
|
2602
2605
|
})
|
|
2603
2606
|
} else {
|