@tanstack/router-core 1.130.5 → 1.130.6
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 +2 -9
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +1 -1
- package/dist/esm/router.d.ts +1 -1
- package/dist/esm/router.js +2 -9
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +5 -14
package/dist/cjs/router.d.cts
CHANGED
|
@@ -430,7 +430,7 @@ export interface MatchRoutesFn {
|
|
|
430
430
|
(pathnameOrNext: string | ParsedLocation, locationSearchOrOpts?: AnySchema | MatchRoutesOpts, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
|
431
431
|
}
|
|
432
432
|
export type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined;
|
|
433
|
-
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) =>
|
|
433
|
+
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
|
434
434
|
export type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>;
|
|
435
435
|
export type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect;
|
|
436
436
|
export type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {
|
package/dist/esm/router.d.ts
CHANGED
|
@@ -430,7 +430,7 @@ export interface MatchRoutesFn {
|
|
|
430
430
|
(pathnameOrNext: string | ParsedLocation, locationSearchOrOpts?: AnySchema | MatchRoutesOpts, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
|
431
431
|
}
|
|
432
432
|
export type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined;
|
|
433
|
-
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) =>
|
|
433
|
+
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
|
434
434
|
export type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>;
|
|
435
435
|
export type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect;
|
|
436
436
|
export type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {
|
package/dist/esm/router.js
CHANGED
|
@@ -689,23 +689,16 @@ class RouterCore {
|
|
|
689
689
|
};
|
|
690
690
|
this.updateMatch = (id, updater) => {
|
|
691
691
|
var _a;
|
|
692
|
-
|
|
693
|
-
const isPending = (_a = this.state.pendingMatches) == null ? void 0 : _a.find((d) => d.id === id);
|
|
694
|
-
const isMatched = this.state.matches.find((d) => d.id === id);
|
|
695
|
-
const isCached = this.state.cachedMatches.find((d) => d.id === id);
|
|
696
|
-
const matchesKey = isPending ? "pendingMatches" : isMatched ? "matches" : isCached ? "cachedMatches" : "";
|
|
692
|
+
const matchesKey = ((_a = this.state.pendingMatches) == null ? void 0 : _a.some((d) => d.id === id)) ? "pendingMatches" : this.state.matches.some((d) => d.id === id) ? "matches" : this.state.cachedMatches.some((d) => d.id === id) ? "cachedMatches" : "";
|
|
697
693
|
if (matchesKey) {
|
|
698
694
|
this.__store.setState((s) => {
|
|
699
695
|
var _a2;
|
|
700
696
|
return {
|
|
701
697
|
...s,
|
|
702
|
-
[matchesKey]: (_a2 = s[matchesKey]) == null ? void 0 : _a2.map(
|
|
703
|
-
(d) => d.id === id ? updated = updater(d) : d
|
|
704
|
-
)
|
|
698
|
+
[matchesKey]: (_a2 = s[matchesKey]) == null ? void 0 : _a2.map((d) => d.id === id ? updater(d) : d)
|
|
705
699
|
};
|
|
706
700
|
});
|
|
707
701
|
}
|
|
708
|
-
return updated;
|
|
709
702
|
};
|
|
710
703
|
this.getMatch = (matchId) => {
|
|
711
704
|
var _a;
|