@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/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -661,7 +661,7 @@ export type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined
|
|
|
661
661
|
export type UpdateMatchFn = (
|
|
662
662
|
id: string,
|
|
663
663
|
updater: (match: AnyRouteMatch) => AnyRouteMatch,
|
|
664
|
-
) =>
|
|
664
|
+
) => void
|
|
665
665
|
|
|
666
666
|
export type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>
|
|
667
667
|
|
|
@@ -2052,29 +2052,20 @@ export class RouterCore<
|
|
|
2052
2052
|
}
|
|
2053
2053
|
|
|
2054
2054
|
updateMatch: UpdateMatchFn = (id, updater) => {
|
|
2055
|
-
|
|
2056
|
-
const isPending = this.state.pendingMatches?.find((d) => d.id === id)
|
|
2057
|
-
const isMatched = this.state.matches.find((d) => d.id === id)
|
|
2058
|
-
const isCached = this.state.cachedMatches.find((d) => d.id === id)
|
|
2059
|
-
|
|
2060
|
-
const matchesKey = isPending
|
|
2055
|
+
const matchesKey = this.state.pendingMatches?.some((d) => d.id === id)
|
|
2061
2056
|
? 'pendingMatches'
|
|
2062
|
-
:
|
|
2057
|
+
: this.state.matches.some((d) => d.id === id)
|
|
2063
2058
|
? 'matches'
|
|
2064
|
-
:
|
|
2059
|
+
: this.state.cachedMatches.some((d) => d.id === id)
|
|
2065
2060
|
? 'cachedMatches'
|
|
2066
2061
|
: ''
|
|
2067
2062
|
|
|
2068
2063
|
if (matchesKey) {
|
|
2069
2064
|
this.__store.setState((s) => ({
|
|
2070
2065
|
...s,
|
|
2071
|
-
[matchesKey]: s[matchesKey]?.map((d) =>
|
|
2072
|
-
d.id === id ? (updated = updater(d)) : d,
|
|
2073
|
-
),
|
|
2066
|
+
[matchesKey]: s[matchesKey]?.map((d) => (d.id === id ? updater(d) : d)),
|
|
2074
2067
|
}))
|
|
2075
2068
|
}
|
|
2076
|
-
|
|
2077
|
-
return updated
|
|
2078
2069
|
}
|
|
2079
2070
|
|
|
2080
2071
|
getMatch: GetMatchFn = (matchId: string) => {
|