@tanstack/router-core 1.130.5 → 1.130.7
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 +9 -16
- 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 +9 -16
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +12 -21
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
|
|
|
@@ -1848,7 +1848,7 @@ export class RouterCore<
|
|
|
1848
1848
|
pendingMatches,
|
|
1849
1849
|
// If a cached moved to pendingMatches, remove it from cachedMatches
|
|
1850
1850
|
cachedMatches: s.cachedMatches.filter(
|
|
1851
|
-
(d) => !pendingMatches.
|
|
1851
|
+
(d) => !pendingMatches.some((e) => e.id === d.id),
|
|
1852
1852
|
),
|
|
1853
1853
|
}))
|
|
1854
1854
|
}
|
|
@@ -1906,14 +1906,14 @@ export class RouterCore<
|
|
|
1906
1906
|
const newMatches = s.pendingMatches || s.matches
|
|
1907
1907
|
|
|
1908
1908
|
exitingMatches = previousMatches.filter(
|
|
1909
|
-
(match) => !newMatches.
|
|
1909
|
+
(match) => !newMatches.some((d) => d.id === match.id),
|
|
1910
1910
|
)
|
|
1911
1911
|
enteringMatches = newMatches.filter(
|
|
1912
1912
|
(match) =>
|
|
1913
|
-
!previousMatches.
|
|
1913
|
+
!previousMatches.some((d) => d.id === match.id),
|
|
1914
1914
|
)
|
|
1915
1915
|
stayingMatches = previousMatches.filter((match) =>
|
|
1916
|
-
newMatches.
|
|
1916
|
+
newMatches.some((d) => d.id === match.id),
|
|
1917
1917
|
)
|
|
1918
1918
|
|
|
1919
1919
|
return {
|
|
@@ -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) => {
|
|
@@ -2116,12 +2107,12 @@ export class RouterCore<
|
|
|
2116
2107
|
}
|
|
2117
2108
|
|
|
2118
2109
|
const resolvePreload = (matchId: string) => {
|
|
2119
|
-
return !!(allPreload && !this.state.matches.
|
|
2110
|
+
return !!(allPreload && !this.state.matches.some((d) => d.id === matchId))
|
|
2120
2111
|
}
|
|
2121
2112
|
|
|
2122
2113
|
// make sure the pending component is immediately rendered when hydrating a match that is not SSRed
|
|
2123
2114
|
// the pending component was already rendered on the server and we want to keep it shown on the client until minPendingMs is reached
|
|
2124
|
-
if (!this.isServer && this.state.matches.
|
|
2115
|
+
if (!this.isServer && this.state.matches.some((d) => d._forcePending)) {
|
|
2125
2116
|
triggerOnReady()
|
|
2126
2117
|
}
|
|
2127
2118
|
|
|
@@ -2599,7 +2590,7 @@ export class RouterCore<
|
|
|
2599
2590
|
loaderPromise: createControlledPromise<void>(),
|
|
2600
2591
|
preload:
|
|
2601
2592
|
!!preload &&
|
|
2602
|
-
!this.state.matches.
|
|
2593
|
+
!this.state.matches.some((d) => d.id === matchId),
|
|
2603
2594
|
}))
|
|
2604
2595
|
|
|
2605
2596
|
const runLoader = async () => {
|