@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/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
- this.startViewTransition(async () => {
2094
- // this.viewTransitionPromise = createControlledPromise<true>()
2095
-
2096
- // Commit the pending matches. If a previous match was
2097
- // removed, place it in the cachedMatches
2098
- let exitingMatches!: Array<AnyRouteMatch>
2099
- let enteringMatches!: Array<AnyRouteMatch>
2100
- let stayingMatches!: Array<AnyRouteMatch>
2101
-
2102
- batch(() => {
2103
- this.__store.setState((s) => {
2104
- const previousMatches = s.matches
2105
- const newMatches = s.pendingMatches || s.matches
2106
-
2107
- exitingMatches = previousMatches.filter(
2108
- (match) => !newMatches.some((d) => d.id === match.id),
2109
- )
2110
- enteringMatches = newMatches.filter(
2111
- (match) =>
2112
- !previousMatches.some((d) => d.id === match.id),
2113
- )
2114
- stayingMatches = newMatches.filter((match) =>
2115
- previousMatches.some((d) => d.id === match.id),
2116
- )
2117
-
2118
- return {
2119
- ...s,
2120
- isLoading: false,
2121
- loadedAt: Date.now(),
2122
- matches: newMatches,
2123
- pendingMatches: undefined,
2124
- cachedMatches: [
2125
- ...s.cachedMatches,
2126
- ...exitingMatches.filter((d) => d.status !== 'error'),
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
- [exitingMatches, 'onLeave'],
2137
- [enteringMatches, 'onEnter'],
2138
- [stayingMatches, 'onStay'],
2139
- ] as const
2140
- ).forEach(([matches, hook]) => {
2141
- matches.forEach((match) => {
2142
- this.looseRoutesById[match.routeId]!.options[hook]?.(match)
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
  })