@tanstack/router-core 1.134.9 → 1.134.12
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 +41 -37
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +41 -37
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +53 -48
package/src/router.ts
CHANGED
|
@@ -2090,56 +2090,61 @@ export class RouterCore<
|
|
|
2090
2090
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2091
2091
|
onReady: async () => {
|
|
2092
2092
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2093
|
+
// Wrap batch in framework-specific transition wrapper (e.g., Solid's startTransition)
|
|
2094
|
+
this.startTransition(() => {
|
|
2095
|
+
this.startViewTransition(async () => {
|
|
2096
|
+
// this.viewTransitionPromise = createControlledPromise<true>()
|
|
2097
|
+
|
|
2098
|
+
// Commit the pending matches. If a previous match was
|
|
2099
|
+
// removed, place it in the cachedMatches
|
|
2100
|
+
let exitingMatches: Array<AnyRouteMatch> = []
|
|
2101
|
+
let enteringMatches: Array<AnyRouteMatch> = []
|
|
2102
|
+
let stayingMatches: Array<AnyRouteMatch> = []
|
|
2103
|
+
|
|
2104
|
+
batch(() => {
|
|
2105
|
+
this.__store.setState((s) => {
|
|
2106
|
+
const previousMatches = s.matches
|
|
2107
|
+
const newMatches = s.pendingMatches || s.matches
|
|
2108
|
+
|
|
2109
|
+
exitingMatches = previousMatches.filter(
|
|
2110
|
+
(match) => !newMatches.some((d) => d.id === match.id),
|
|
2111
|
+
)
|
|
2112
|
+
enteringMatches = newMatches.filter(
|
|
2113
|
+
(match) =>
|
|
2114
|
+
!previousMatches.some((d) => d.id === match.id),
|
|
2115
|
+
)
|
|
2116
|
+
stayingMatches = newMatches.filter((match) =>
|
|
2117
|
+
previousMatches.some((d) => d.id === match.id),
|
|
2118
|
+
)
|
|
2119
|
+
|
|
2120
|
+
return {
|
|
2121
|
+
...s,
|
|
2122
|
+
isLoading: false,
|
|
2123
|
+
loadedAt: Date.now(),
|
|
2124
|
+
matches: newMatches,
|
|
2125
|
+
pendingMatches: undefined,
|
|
2126
|
+
cachedMatches: [
|
|
2127
|
+
...s.cachedMatches,
|
|
2128
|
+
...exitingMatches.filter((d) => d.status !== 'error'),
|
|
2129
|
+
],
|
|
2130
|
+
}
|
|
2131
|
+
})
|
|
2132
|
+
this.clearExpiredCache()
|
|
2129
2133
|
})
|
|
2130
|
-
this.clearExpiredCache()
|
|
2131
|
-
})
|
|
2132
2134
|
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2135
|
+
//
|
|
2136
|
+
;(
|
|
2137
|
+
[
|
|
2138
|
+
[exitingMatches, 'onLeave'],
|
|
2139
|
+
[enteringMatches, 'onEnter'],
|
|
2140
|
+
[stayingMatches, 'onStay'],
|
|
2141
|
+
] as const
|
|
2142
|
+
).forEach(([matches, hook]) => {
|
|
2143
|
+
matches.forEach((match) => {
|
|
2144
|
+
this.looseRoutesById[match.routeId]!.options[hook]?.(
|
|
2145
|
+
match,
|
|
2146
|
+
)
|
|
2147
|
+
})
|
|
2143
2148
|
})
|
|
2144
2149
|
})
|
|
2145
2150
|
})
|