@tanstack/react-router 0.0.1-beta.188 → 0.0.1-beta.189
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.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +96 -96
- package/build/types/react.d.ts +8 -2
- package/build/umd/index.development.js +16 -39
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/react.tsx +20 -9
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.189",
|
|
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.189"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/react.tsx
CHANGED
|
@@ -41,10 +41,17 @@ import {
|
|
|
41
41
|
ResolveAllParams,
|
|
42
42
|
} from '@tanstack/router-core'
|
|
43
43
|
|
|
44
|
-
const useLayoutEffect =
|
|
45
|
-
typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect
|
|
46
|
-
|
|
47
44
|
declare module '@tanstack/router-core' {
|
|
45
|
+
interface RouterOptions<
|
|
46
|
+
TRouteTree extends AnyRoute,
|
|
47
|
+
TDehydrated extends Record<string, any>,
|
|
48
|
+
> {
|
|
49
|
+
Wrap?: React.ComponentType<{
|
|
50
|
+
children: React.ReactNode
|
|
51
|
+
dehydratedState?: TDehydrated
|
|
52
|
+
}>
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
interface RegisterRouteComponent<
|
|
49
56
|
TLoader = unknown,
|
|
50
57
|
TFullSearchSchema extends AnySearchSchema = AnySearchSchema,
|
|
@@ -907,7 +914,13 @@ export function useNavigate<
|
|
|
907
914
|
TMaskFrom extends RoutePaths<TRouteTree> = '/',
|
|
908
915
|
TMaskTo extends string = '',
|
|
909
916
|
>(
|
|
910
|
-
opts?: NavigateOptions<
|
|
917
|
+
opts?: NavigateOptions<
|
|
918
|
+
RegisteredRouter['routeTree'],
|
|
919
|
+
TFrom,
|
|
920
|
+
TTo,
|
|
921
|
+
TMaskFrom,
|
|
922
|
+
TMaskTo
|
|
923
|
+
>,
|
|
911
924
|
) => {
|
|
912
925
|
return router.navigate({ ...defaultOpts, ...(opts as any) })
|
|
913
926
|
},
|
|
@@ -915,18 +928,16 @@ export function useNavigate<
|
|
|
915
928
|
)
|
|
916
929
|
}
|
|
917
930
|
|
|
918
|
-
export function useMatchRoute
|
|
919
|
-
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
920
|
-
>() {
|
|
931
|
+
export function useMatchRoute() {
|
|
921
932
|
const router = useRouter()
|
|
922
933
|
|
|
923
934
|
return React.useCallback(
|
|
924
935
|
<
|
|
936
|
+
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
925
937
|
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
926
938
|
TTo extends string = '',
|
|
927
939
|
TMaskFrom extends RoutePaths<TRouteTree> = '/',
|
|
928
940
|
TMaskTo extends string = '',
|
|
929
|
-
TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>,
|
|
930
941
|
>(
|
|
931
942
|
opts: MakeUseMatchRouteOptions<
|
|
932
943
|
TRouteTree,
|
|
@@ -935,7 +946,7 @@ export function useMatchRoute<
|
|
|
935
946
|
TMaskFrom,
|
|
936
947
|
TMaskTo
|
|
937
948
|
>,
|
|
938
|
-
)
|
|
949
|
+
) => {
|
|
939
950
|
const { pending, caseSensitive, ...rest } = opts
|
|
940
951
|
|
|
941
952
|
return router.matchRoute(rest as any, {
|