@tanstack/router-core 0.0.1-beta.166 → 0.0.1-beta.168

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.166",
4
+ "version": "0.0.1-beta.168",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -43,7 +43,7 @@
43
43
  "tiny-invariant": "^1.3.1",
44
44
  "tiny-warning": "^1.0.3",
45
45
  "@gisatcz/cross-package-react-context": "^0.2.0",
46
- "@tanstack/react-store": "0.0.1-beta.166"
46
+ "@tanstack/react-store": "0.0.1-beta.168"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "rollup --config rollup.config.js",
package/src/defer.ts ADDED
@@ -0,0 +1,55 @@
1
+ export type DeferredPromiseState<T> = { uid: string } & (
2
+ | {
3
+ status: 'pending'
4
+ data?: T
5
+ error?: unknown
6
+ }
7
+ | {
8
+ status: 'success'
9
+ data: T
10
+ }
11
+ | {
12
+ status: 'error'
13
+ data?: T
14
+ error: unknown
15
+ }
16
+ )
17
+
18
+ export type DeferredPromise<T> = Promise<T> & {
19
+ __deferredState: DeferredPromiseState<T>
20
+ }
21
+
22
+ export function defer<T>(_promise: Promise<T>) {
23
+ const promise = _promise as DeferredPromise<T>
24
+
25
+ if (!promise.__deferredState) {
26
+ promise.__deferredState = {
27
+ uid: Math.random().toString(36).slice(2),
28
+ status: 'pending',
29
+ }
30
+
31
+ const state = promise.__deferredState
32
+
33
+ promise
34
+ .then((data) => {
35
+ state.status = 'success' as any
36
+ state.data = data
37
+ })
38
+ .catch((error) => {
39
+ state.status = 'error' as any
40
+ state.error = error
41
+ })
42
+ }
43
+
44
+ return promise
45
+ }
46
+
47
+ export function isDehydratedDeferred(obj: any): boolean {
48
+ return (
49
+ typeof obj === 'object' &&
50
+ obj !== null &&
51
+ !(obj instanceof Promise) &&
52
+ !obj.then &&
53
+ '__deferredState' in obj
54
+ )
55
+ }
package/src/fileRoute.ts CHANGED
@@ -2,7 +2,6 @@ import { ParsePathParams } from './link'
2
2
  import {
3
3
  AnyRoute,
4
4
  ResolveFullPath,
5
- AnySearchSchema,
6
5
  ResolveFullSearchSchema,
7
6
  MergeParamsFromParent,
8
7
  RouteContext,
package/src/index.ts CHANGED
@@ -11,3 +11,4 @@ export * from './router'
11
11
  export * from './searchParams'
12
12
  export * from './utils'
13
13
  export * from './scroll-restoration'
14
+ export * from './defer'
package/src/route.ts CHANGED
@@ -11,26 +11,157 @@ export type AnySearchSchema = {}
11
11
  export type AnyContext = {}
12
12
  export interface RouteMeta {}
13
13
  export interface RouteContext {}
14
- export interface RegisterRouteComponent<TProps> {
14
+ export interface RegisterRouteComponent<
15
+ TLoader = unknown,
16
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
17
+ TAllParams extends AnyPathParams = AnyPathParams,
18
+ TRouteContext extends AnyContext = AnyContext,
19
+ TAllContext extends AnyContext = AnyContext,
20
+ > {
15
21
  // RouteComponent: unknown // This is registered by the framework
16
22
  }
17
- export interface RegisterRouteErrorComponent<TProps> {
18
- // RouteErrorComponent: unknown // This is registered by the framework
23
+ export interface RegisterErrorRouteComponent<
24
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
25
+ TAllParams extends AnyPathParams = AnyPathParams,
26
+ TRouteContext extends AnyContext = AnyContext,
27
+ TAllContext extends AnyContext = AnyContext,
28
+ > {
29
+ // ErrorRouteComponent: unknown // This is registered by the framework
30
+ }
31
+ export interface RegisterPendingRouteComponent<
32
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
33
+ TAllParams extends AnyPathParams = AnyPathParams,
34
+ TRouteContext extends AnyContext = AnyContext,
35
+ TAllContext extends AnyContext = AnyContext,
36
+ > {
37
+ // PendingRouteComponent: unknown // This is registered by the framework
38
+ }
39
+ export interface RegisterRouteProps<
40
+ TLoader = unknown,
41
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
42
+ TAllParams extends AnyPathParams = AnyPathParams,
43
+ TRouteContext extends AnyContext = AnyContext,
44
+ TAllContext extends AnyContext = AnyContext,
45
+ > {
46
+ // RouteProps: unknown // This is registered by the framework
47
+ }
48
+ export interface RegisterErrorRouteProps<
49
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
50
+ TAllParams extends AnyPathParams = AnyPathParams,
51
+ TRouteContext extends AnyContext = AnyContext,
52
+ TAllContext extends AnyContext = AnyContext,
53
+ > {
54
+ // ErrorRouteProps: unknown // This is registered by the framework
19
55
  }
20
56
 
21
- export type RegisteredRouteComponent<TProps> =
22
- RegisterRouteComponent<TProps> extends {
23
- RouteComponent: infer T
24
- }
25
- ? T
26
- : (props: TProps) => unknown
57
+ export interface RegisterPendingRouteProps<
58
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
59
+ TAllParams extends AnyPathParams = AnyPathParams,
60
+ TRouteContext extends AnyContext = AnyContext,
61
+ TAllContext extends AnyContext = AnyContext,
62
+ > {
63
+ // PendingRouteProps: unknown // This is registered by the framework
64
+ }
27
65
 
28
- export type RegisteredRouteErrorComponent<TProps> =
29
- RegisterRouteErrorComponent<TProps> extends {
30
- RouteErrorComponent: infer T
31
- }
32
- ? T
33
- : (props: TProps) => unknown
66
+ export type RegisteredRouteComponent<
67
+ TLoader = unknown,
68
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
69
+ TAllParams extends AnyPathParams = AnyPathParams,
70
+ TRouteContext extends AnyContext = AnyContext,
71
+ TAllContext extends AnyContext = AnyContext,
72
+ > = RegisterRouteComponent<
73
+ TLoader,
74
+ TFullSearchSchema,
75
+ TAllParams,
76
+ TRouteContext,
77
+ TAllContext
78
+ > extends {
79
+ RouteComponent: infer T
80
+ }
81
+ ? T
82
+ : () => unknown
83
+
84
+ export type RegisteredErrorRouteComponent<
85
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
86
+ TAllParams extends AnyPathParams = AnyPathParams,
87
+ TRouteContext extends AnyContext = AnyContext,
88
+ TAllContext extends AnyContext = AnyContext,
89
+ > = RegisterErrorRouteComponent<
90
+ TFullSearchSchema,
91
+ TAllParams,
92
+ TRouteContext,
93
+ TAllContext
94
+ > extends {
95
+ ErrorRouteComponent: infer T
96
+ }
97
+ ? T
98
+ : () => unknown
99
+
100
+ export type RegisteredPendingRouteComponent<
101
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
102
+ TAllParams extends AnyPathParams = AnyPathParams,
103
+ TRouteContext extends AnyContext = AnyContext,
104
+ TAllContext extends AnyContext = AnyContext,
105
+ > = RegisterPendingRouteComponent<
106
+ TFullSearchSchema,
107
+ TAllParams,
108
+ TRouteContext,
109
+ TAllContext
110
+ > extends {
111
+ PendingRouteComponent: infer T
112
+ }
113
+ ? T
114
+ : () => unknown
115
+
116
+ export type RegisteredRouteProps<
117
+ TLoader = unknown,
118
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
119
+ TAllParams extends AnyPathParams = AnyPathParams,
120
+ TRouteContext extends AnyContext = AnyContext,
121
+ TAllContext extends AnyContext = AnyContext,
122
+ > = RegisterRouteProps<
123
+ TLoader,
124
+ TFullSearchSchema,
125
+ TAllParams,
126
+ TRouteContext,
127
+ TAllContext
128
+ > extends {
129
+ RouteProps: infer T
130
+ }
131
+ ? T
132
+ : {}
133
+
134
+ export type RegisteredErrorRouteProps<
135
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
136
+ TAllParams extends AnyPathParams = AnyPathParams,
137
+ TRouteContext extends AnyContext = AnyContext,
138
+ TAllContext extends AnyContext = AnyContext,
139
+ > = RegisterRouteProps<
140
+ TFullSearchSchema,
141
+ TAllParams,
142
+ TRouteContext,
143
+ TAllContext
144
+ > extends {
145
+ ErrorRouteProps: infer T
146
+ }
147
+ ? T
148
+ : {}
149
+
150
+ export type RegisteredPendingRouteProps<
151
+ TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
152
+ TAllParams extends AnyPathParams = AnyPathParams,
153
+ TRouteContext extends AnyContext = AnyContext,
154
+ TAllContext extends AnyContext = AnyContext,
155
+ > = RegisterRouteProps<
156
+ TFullSearchSchema,
157
+ TAllParams,
158
+ TRouteContext,
159
+ TAllContext
160
+ > extends {
161
+ PendingRouteProps: infer T
162
+ }
163
+ ? T
164
+ : {}
34
165
 
35
166
  export type PreloadableObj = { preload?: () => Promise<void> }
36
167
 
@@ -53,7 +184,7 @@ export type MetaOptions = keyof PickRequired<RouteMeta> extends never
53
184
  meta: RouteMeta
54
185
  }
55
186
 
56
- export type AnyRouteProps = RouteProps<any, any, any, any, any>
187
+ export type AnyRouteProps = RegisteredRouteProps<any, any, any, any, any>
57
188
  export type ComponentPropsFromRoute<TRoute> = TRoute extends Route<
58
189
  infer TParentRoute,
59
190
  infer TPath,
@@ -73,7 +204,13 @@ export type ComponentPropsFromRoute<TRoute> = TRoute extends Route<
73
204
  infer TChildren,
74
205
  infer TRouteTree
75
206
  >
76
- ? RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>
207
+ ? RegisteredRouteProps<
208
+ TLoader,
209
+ TFullSearchSchema,
210
+ TAllParams,
211
+ TRouteContext,
212
+ TContext
213
+ >
77
214
  : never
78
215
 
79
216
  export type ComponentFromRoute<TRoute> = RegisteredRouteComponent<
@@ -89,67 +226,6 @@ export type RouteLoaderFromRoute<TRoute extends AnyRoute> = LoaderFn<
89
226
  TRoute['types']['context']
90
227
  >
91
228
 
92
- export type RouteProps<
93
- TLoader extends any = unknown,
94
- TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
95
- TAllParams extends AnyPathParams = AnyPathParams,
96
- TRouteContext extends AnyContext = AnyContext,
97
- TContext extends AnyContext = AnyContext,
98
- > = {
99
- useMatch: () => RouteMatch<any, any>
100
- useLoader: () => UseLoaderResult<TLoader>
101
- useSearch: <
102
- TStrict extends boolean = true,
103
- TSearch = TFullSearchSchema,
104
- TSelected = TSearch,
105
- >(opts?: {
106
- strict?: TStrict
107
- select?: (search: TSearch) => TSelected
108
- }) => TStrict extends true ? TSelected : TSelected | undefined
109
- useParams: <
110
- TDefaultSelected = TAllParams,
111
- TSelected = TDefaultSelected,
112
- >(opts?: {
113
- select?: (params: TDefaultSelected) => TSelected
114
- }) => TSelected
115
- useContext: <
116
- TDefaultSelected = TContext,
117
- TSelected = TDefaultSelected,
118
- >(opts?: {
119
- select?: (context: TDefaultSelected) => TSelected
120
- }) => TSelected
121
- useRouteContext: <
122
- TDefaultSelected = TRouteContext,
123
- TSelected = TDefaultSelected,
124
- >(opts?: {
125
- select?: (context: TDefaultSelected) => TSelected
126
- }) => TSelected
127
- }
128
-
129
- export type PendingRouteProps<
130
- TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
131
- TAllParams extends AnyPathParams = AnyPathParams,
132
- TRouteContext extends AnyContext = AnyContext,
133
- TContext extends AnyContext = AnyContext,
134
- > = Omit<
135
- RouteProps<any, TFullSearchSchema, TAllParams, TRouteContext, TContext>,
136
- 'useLoader'
137
- >
138
-
139
- export type ErrorRouteProps<
140
- TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
141
- TAllParams extends AnyPathParams = AnyPathParams,
142
- TRouteContext extends AnyContext = AnyContext,
143
- TContext extends AnyContext = AnyContext,
144
- > = PendingRouteProps<
145
- TFullSearchSchema,
146
- TAllParams,
147
- TRouteContext,
148
- TContext
149
- > & {
150
- error: unknown
151
- }
152
-
153
229
  export type RouteOptions<
154
230
  TParentRoute extends AnyRoute = AnyRoute,
155
231
  TCustomId extends string = string,
@@ -295,7 +371,7 @@ export type UpdatableRouteOptions<
295
371
  TFullSearchSchema extends AnySearchSchema,
296
372
  TAllParams extends AnyPathParams,
297
373
  TRouteContext extends AnyContext,
298
- TContext extends AnyContext,
374
+ TAllContext extends AnyContext,
299
375
  > = MetaOptions & {
300
376
  key?: null | false | GetKeyFn<TFullSearchSchema, TAllParams>
301
377
  // If true, this route will be matched as case-sensitive
@@ -304,15 +380,25 @@ export type UpdatableRouteOptions<
304
380
  wrapInSuspense?: boolean
305
381
  // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
306
382
  component?: RegisteredRouteComponent<
307
- RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>
383
+ TLoader,
384
+ TFullSearchSchema,
385
+ TAllParams,
386
+ TRouteContext,
387
+ TAllContext
308
388
  >
309
389
  // The content to be rendered when the route encounters an error
310
- errorComponent?: RegisteredRouteErrorComponent<
311
- ErrorRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TContext>
390
+ errorComponent?: RegisteredErrorRouteComponent<
391
+ TFullSearchSchema,
392
+ TAllParams,
393
+ TRouteContext,
394
+ TAllContext
312
395
  > //
313
396
  // If supported by your framework, the content to be rendered as the fallback content until the route is ready to render
314
- pendingComponent?: RegisteredRouteComponent<
315
- PendingRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TContext>
397
+ pendingComponent?: RegisteredPendingRouteComponent<
398
+ TFullSearchSchema,
399
+ TAllParams,
400
+ TRouteContext,
401
+ TAllContext
316
402
  >
317
403
  // Filter functions that can manipulate search params *before* they are passed to links and navigate
318
404
  // calls that match this route.
@@ -336,7 +422,7 @@ export type UpdatableRouteOptions<
336
422
  TFullSearchSchema,
337
423
  TAllParams,
338
424
  NoInfer<TRouteContext>,
339
- TContext
425
+ TAllContext
340
426
  >,
341
427
  ) => Promise<void> | void
342
428
  onError?: (err: any) => void
@@ -489,15 +575,16 @@ export interface AnyRoute
489
575
 
490
576
  export type MergeParamsFromParent<T, U> = IsAny<T, U, T & U>
491
577
 
492
- export type UseLoaderResult<T> = T extends Record<PropertyKey, infer U>
493
- ? {
494
- [K in keyof T]: UseLoaderResultPromise<T[K]>
495
- }
496
- : UseLoaderResultPromise<T>
578
+ export type UseLoaderResult<T> = T
579
+ // T extends Record<PropertyKey, infer U>
580
+ // ? {
581
+ // [K in keyof T]: UseLoaderResultPromise<T[K]>
582
+ // }
583
+ // : UseLoaderResultPromise<T>
497
584
 
498
- export type UseLoaderResultPromise<T> = T extends Promise<infer U>
499
- ? StreamedPromise<U>
500
- : T
585
+ // export type UseLoaderResultPromise<T> = T extends Promise<infer U>
586
+ // ? StreamedPromise<U>
587
+ // : T
501
588
 
502
589
  export type StreamedPromise<T> = {
503
590
  promise: Promise<T>
package/src/router.ts CHANGED
@@ -26,10 +26,9 @@ import {
26
26
  AnyRoute,
27
27
  AnyContext,
28
28
  AnyPathParams,
29
- RouteProps,
30
29
  RegisteredRouteComponent,
31
- RegisteredRouteErrorComponent,
32
- ErrorRouteProps,
30
+ RegisteredErrorRouteComponent,
31
+ RegisteredPendingRouteComponent,
33
32
  } from './route'
34
33
  import {
35
34
  RoutesById,
@@ -157,13 +156,23 @@ export interface RouterOptions<
157
156
  defaultPreload?: false | 'intent'
158
157
  defaultPreloadDelay?: number
159
158
  defaultComponent?: RegisteredRouteComponent<
160
- RouteProps<unknown, AnySearchSchema, AnyPathParams, AnyContext, AnyContext>
159
+ unknown,
160
+ AnySearchSchema,
161
+ AnyPathParams,
162
+ AnyContext,
163
+ AnyContext
161
164
  >
162
- defaultErrorComponent?: RegisteredRouteErrorComponent<
163
- ErrorRouteProps<AnySearchSchema, AnyPathParams, AnyContext, AnyContext>
165
+ defaultErrorComponent?: RegisteredErrorRouteComponent<
166
+ AnySearchSchema,
167
+ AnyPathParams,
168
+ AnyContext,
169
+ AnyContext
164
170
  >
165
- defaultPendingComponent?: RegisteredRouteComponent<
166
- RouteProps<unknown, AnySearchSchema, AnyPathParams, AnyContext, AnyContext>
171
+ defaultPendingComponent?: RegisteredPendingRouteComponent<
172
+ AnySearchSchema,
173
+ AnyPathParams,
174
+ AnyContext,
175
+ AnyContext
167
176
  >
168
177
  defaultMaxAge?: number
169
178
  defaultGcMaxAge?: number
@@ -230,8 +239,20 @@ type LinkCurrentTargetElement = {
230
239
  preloadTimeout?: null | ReturnType<typeof setTimeout>
231
240
  }
232
241
 
233
- export interface DehydratedRouterState
234
- extends Pick<RouterState, 'status' | 'location' | 'lastUpdated'> {}
242
+ export interface DehydratedRouterState {
243
+ dehydratedMatches: DehydratedRouteMatch[]
244
+ }
245
+
246
+ export type DehydratedRouteMatch = Pick<
247
+ RouteMatch,
248
+ | 'fetchedAt'
249
+ | 'invalid'
250
+ | 'invalidAt'
251
+ | 'id'
252
+ | 'loaderData'
253
+ | 'status'
254
+ | 'updatedAt'
255
+ >
235
256
 
236
257
  export interface DehydratedRouter {
237
258
  state: DehydratedRouterState
@@ -444,7 +465,7 @@ export class Router<
444
465
  this.basepath = `/${trimPath(basepath ?? '') ?? ''}`
445
466
 
446
467
  if (routeTree && routeTree !== this.routeTree) {
447
- this.#buildRouteTree(routeTree)
468
+ this.#processRoutes(routeTree)
448
469
  }
449
470
 
450
471
  return this
@@ -481,7 +502,11 @@ export class Router<
481
502
 
482
503
  latestLoadPromise: Promise<void> = Promise.resolve()
483
504
 
484
- load = async (opts?: { next?: ParsedLocation; throwOnError?: boolean }) => {
505
+ load = async (opts?: {
506
+ next?: ParsedLocation
507
+ throwOnError?: boolean
508
+ __dehydratedMatches?: DehydratedRouteMatch[]
509
+ }) => {
485
510
  const promise = new Promise<void>(async (resolve, reject) => {
486
511
  const prevLocation = this.state.resolvedLocation
487
512
  const pathDidChange = !!(
@@ -879,8 +904,6 @@ export class Router<
879
904
  maxAge?: number
880
905
  },
881
906
  ) => {
882
- this.cleanMatches()
883
-
884
907
  if (!opts?.preload) {
885
908
  resolvedMatches.forEach((match) => {
886
909
  // Update each match with its latest route data
@@ -894,10 +917,13 @@ export class Router<
894
917
  paramsError: match.paramsError,
895
918
  searchError: match.searchError,
896
919
  params: match.params,
920
+ preloadInvalidAt: 0,
897
921
  }))
898
922
  })
899
923
  }
900
924
 
925
+ this.cleanMatches()
926
+
901
927
  let firstBadMatchIndex: number | undefined
902
928
 
903
929
  // Check each match middleware to see if the route can be accessed
@@ -1072,6 +1098,8 @@ export class Router<
1072
1098
  })
1073
1099
 
1074
1100
  await Promise.all(matchPromises)
1101
+
1102
+ this.cleanMatches()
1075
1103
  }
1076
1104
 
1077
1105
  reload = () => {
@@ -1313,7 +1341,19 @@ export class Router<
1313
1341
 
1314
1342
  dehydrate = (): DehydratedRouter => {
1315
1343
  return {
1316
- state: pick(this.state, ['location', 'status', 'lastUpdated']),
1344
+ state: {
1345
+ dehydratedMatches: this.state.matches.map((d) =>
1346
+ pick(d, [
1347
+ 'fetchedAt',
1348
+ 'invalid',
1349
+ 'invalidAt',
1350
+ 'id',
1351
+ 'loaderData',
1352
+ 'status',
1353
+ 'updatedAt',
1354
+ ]),
1355
+ ),
1356
+ },
1317
1357
  }
1318
1358
  }
1319
1359
 
@@ -1332,19 +1372,35 @@ export class Router<
1332
1372
  const ctx = _ctx
1333
1373
  this.dehydratedData = ctx.payload as any
1334
1374
  this.options.hydrate?.(ctx.payload as any)
1335
- const routerState = ctx.router.state as RouterState<TRouteTree>
1375
+ const { dehydratedMatches } = ctx.router.state
1376
+
1377
+ let matches = this.matchRoutes(
1378
+ this.state.location.pathname,
1379
+ this.state.location.search,
1380
+ ).map((match) => {
1381
+ const dehydratedMatch = dehydratedMatches.find((d) => d.id === match.id)
1382
+
1383
+ invariant(
1384
+ dehydratedMatch,
1385
+ `Could not find a client-side match for dehydrated match with id: ${match.id}!`,
1386
+ )
1387
+
1388
+ if (dehydratedMatch) {
1389
+ return {
1390
+ ...match,
1391
+ ...dehydratedMatch,
1392
+ }
1393
+ }
1394
+ return match
1395
+ })
1336
1396
 
1337
1397
  this.__store.setState((s) => {
1338
1398
  return {
1339
1399
  ...s,
1340
- ...routerState,
1341
- resolvedLocation: routerState.location,
1400
+ matches,
1401
+ matchesById: this.#mergeMatches(s.matchesById, matches),
1342
1402
  }
1343
1403
  })
1344
-
1345
- await this.load()
1346
-
1347
- return
1348
1404
  }
1349
1405
 
1350
1406
  injectedHtml: (string | (() => Promise<string> | string))[] = []
@@ -1364,10 +1420,10 @@ export class Router<
1364
1420
  return `<script id='${id}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${escapeJSON(
1365
1421
  strKey,
1366
1422
  )}"] = ${JSON.stringify(data)}
1367
- ;(() => {
1368
- var el = document.getElementById('${id}')
1369
- el.parentElement.removeChild(el)
1370
- })()
1423
+ // ;(() => {
1424
+ // var el = document.getElementById('${id}')
1425
+ // el.parentElement.removeChild(el)
1426
+ // })()
1371
1427
  </script>`
1372
1428
  })
1373
1429
 
@@ -1393,7 +1449,7 @@ export class Router<
1393
1449
  // ?.__promisesByKey[key]?.resolve(value)
1394
1450
  // }
1395
1451
 
1396
- #buildRouteTree = (routeTree: TRouteTree) => {
1452
+ #processRoutes = (routeTree: TRouteTree) => {
1397
1453
  this.routeTree = routeTree as any
1398
1454
  this.routesById = {} as any
1399
1455
  this.routesByPath = {} as any
@@ -1717,9 +1773,6 @@ export class Router<
1717
1773
  preloadInvalidAt,
1718
1774
  invalidAt,
1719
1775
  }))
1720
-
1721
- if (this.state.matches.find((d) => d.id === id)) {
1722
- }
1723
1776
  }
1724
1777
 
1725
1778
  invalidate = async (opts?: {