@tanstack/react-router 0.0.1-beta.194 → 0.0.1-beta.196
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/build/cjs/react.js +2 -1
- package/build/cjs/react.js.map +1 -1
- package/build/esm/index.js +2 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +123 -98
- package/build/types/react.d.ts +16 -16
- package/build/umd/index.development.js +138 -54
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +12 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/react.tsx +11 -49
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.196",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tiny-warning": "^1.0.3",
|
|
45
45
|
"@tanstack/react-store": "^0.0.1",
|
|
46
46
|
"@gisatcz/cross-package-react-context": "^0.2.0",
|
|
47
|
-
"@tanstack/router-core": "0.0.1-beta.
|
|
47
|
+
"@tanstack/router-core": "0.0.1-beta.196"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/react.tsx
CHANGED
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
ResolveId,
|
|
23
23
|
AnySearchSchema,
|
|
24
24
|
ParsePathParams,
|
|
25
|
-
MergeFromFromParent,
|
|
26
25
|
RouteContext,
|
|
27
26
|
AnyContext,
|
|
28
27
|
UseLoaderResult,
|
|
@@ -43,6 +42,9 @@ import {
|
|
|
43
42
|
IsAny,
|
|
44
43
|
} from '@tanstack/router-core'
|
|
45
44
|
|
|
45
|
+
const useLayoutEffect =
|
|
46
|
+
typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect
|
|
47
|
+
|
|
46
48
|
declare module '@tanstack/router-core' {
|
|
47
49
|
interface RouterOptions<
|
|
48
50
|
TRouteTree extends AnyRoute,
|
|
@@ -58,44 +60,30 @@ declare module '@tanstack/router-core' {
|
|
|
58
60
|
TLoader = unknown,
|
|
59
61
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
60
62
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
61
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
62
63
|
TAllContext extends Record<string, any> = AnyContext,
|
|
63
64
|
> {
|
|
64
65
|
RouteComponent: RouteComponent<
|
|
65
|
-
RouteProps<
|
|
66
|
-
TLoader,
|
|
67
|
-
TFullSearchSchema,
|
|
68
|
-
TAllParams,
|
|
69
|
-
TRouteContext,
|
|
70
|
-
TAllContext
|
|
71
|
-
>
|
|
66
|
+
RouteProps<TLoader, TFullSearchSchema, TAllParams, TAllContext>
|
|
72
67
|
>
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
interface RegisterErrorRouteComponent<
|
|
76
71
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
77
72
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
78
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
79
73
|
TAllContext extends Record<string, any> = AnyContext,
|
|
80
74
|
> {
|
|
81
75
|
ErrorRouteComponent: RouteComponent<
|
|
82
|
-
ErrorRouteProps<TFullSearchSchema, TAllParams,
|
|
76
|
+
ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>
|
|
83
77
|
>
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
interface RegisterPendingRouteComponent<
|
|
87
81
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
88
82
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
89
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
90
83
|
TAllContext extends Record<string, any> = AnyContext,
|
|
91
84
|
> {
|
|
92
85
|
PendingRouteComponent: RouteComponent<
|
|
93
|
-
PendingRouteProps<
|
|
94
|
-
TFullSearchSchema,
|
|
95
|
-
TAllParams,
|
|
96
|
-
TRouteContext,
|
|
97
|
-
TAllContext
|
|
98
|
-
>
|
|
86
|
+
PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>
|
|
99
87
|
>
|
|
100
88
|
}
|
|
101
89
|
|
|
@@ -161,28 +149,19 @@ declare module '@tanstack/router-core' {
|
|
|
161
149
|
TLoader = unknown,
|
|
162
150
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
163
151
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
164
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
165
152
|
TAllContext extends Record<string, any> = AnyContext,
|
|
166
153
|
> {
|
|
167
|
-
RouteProps: RouteProps<
|
|
168
|
-
TLoader,
|
|
169
|
-
TFullSearchSchema,
|
|
170
|
-
TAllParams,
|
|
171
|
-
TRouteContext,
|
|
172
|
-
TAllContext
|
|
173
|
-
>
|
|
154
|
+
RouteProps: RouteProps<TLoader, TFullSearchSchema, TAllParams, TAllContext>
|
|
174
155
|
}
|
|
175
156
|
|
|
176
157
|
interface RegisterPendingRouteProps<
|
|
177
158
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
178
159
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
179
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
180
160
|
TAllContext extends Record<string, any> = AnyContext,
|
|
181
161
|
> {
|
|
182
162
|
PendingRouteProps: PendingRouteProps<
|
|
183
163
|
TFullSearchSchema,
|
|
184
164
|
TAllParams,
|
|
185
|
-
TRouteContext,
|
|
186
165
|
TAllContext
|
|
187
166
|
>
|
|
188
167
|
}
|
|
@@ -190,7 +169,6 @@ declare module '@tanstack/router-core' {
|
|
|
190
169
|
interface RegisterErrorRouteProps<
|
|
191
170
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
192
171
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
193
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
194
172
|
TAllContext extends Record<string, any> = AnyContext,
|
|
195
173
|
> {
|
|
196
174
|
ErrorRouteProps: ErrorRouteProps
|
|
@@ -201,7 +179,6 @@ export type RouteProps<
|
|
|
201
179
|
TLoader = unknown,
|
|
202
180
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
203
181
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
204
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
205
182
|
TAllContext extends Record<string, any> = AnyContext,
|
|
206
183
|
> = {
|
|
207
184
|
useLoader: <TSelected = TLoader>(opts?: {
|
|
@@ -224,35 +201,21 @@ export type RouteProps<
|
|
|
224
201
|
export type ErrorRouteProps<
|
|
225
202
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
226
203
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
227
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
228
204
|
TAllContext extends Record<string, any> = AnyContext,
|
|
229
205
|
> = {
|
|
230
206
|
error: unknown
|
|
231
207
|
info: { componentStack: string }
|
|
232
208
|
} & Omit<
|
|
233
|
-
RouteProps<
|
|
234
|
-
unknown,
|
|
235
|
-
TFullSearchSchema,
|
|
236
|
-
TAllParams,
|
|
237
|
-
TRouteContext,
|
|
238
|
-
TAllContext
|
|
239
|
-
>,
|
|
209
|
+
RouteProps<unknown, TFullSearchSchema, TAllParams, TAllContext>,
|
|
240
210
|
'useLoader'
|
|
241
211
|
>
|
|
242
212
|
|
|
243
213
|
export type PendingRouteProps<
|
|
244
214
|
TFullSearchSchema extends Record<string, any> = AnySearchSchema,
|
|
245
215
|
TAllParams extends AnyPathParams = AnyPathParams,
|
|
246
|
-
TRouteContext extends Record<string, any> = AnyContext,
|
|
247
216
|
TAllContext extends Record<string, any> = AnyContext,
|
|
248
217
|
> = Omit<
|
|
249
|
-
RouteProps<
|
|
250
|
-
unknown,
|
|
251
|
-
TFullSearchSchema,
|
|
252
|
-
TAllParams,
|
|
253
|
-
TRouteContext,
|
|
254
|
-
TAllContext
|
|
255
|
-
>,
|
|
218
|
+
RouteProps<unknown, TFullSearchSchema, TAllParams, TAllContext>,
|
|
256
219
|
'useLoader'
|
|
257
220
|
>
|
|
258
221
|
|
|
@@ -360,8 +323,7 @@ export type MakeUseMatchRouteOptions<
|
|
|
360
323
|
TTo extends string = '',
|
|
361
324
|
TMaskFrom extends RoutePaths<TRouteTree> = '/',
|
|
362
325
|
TMaskTo extends string = '',
|
|
363
|
-
> = ToOptions<
|
|
364
|
-
MatchRouteOptions
|
|
326
|
+
> = ToOptions<AnyRoute, TFrom, TTo, TMaskFrom, TMaskTo> & MatchRouteOptions
|
|
365
327
|
|
|
366
328
|
export type MakeMatchRouteOptions<
|
|
367
329
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
@@ -578,7 +540,7 @@ export function Navigate<
|
|
|
578
540
|
>(props: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): null {
|
|
579
541
|
const router = useRouter()
|
|
580
542
|
|
|
581
|
-
|
|
543
|
+
useLayoutEffect(() => {
|
|
582
544
|
router.navigate(props as any)
|
|
583
545
|
}, [])
|
|
584
546
|
|