@tanstack/react-router 0.0.1-beta.167 → 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/build/cjs/{deferred.js → awaited.js} +8 -8
- package/build/cjs/awaited.js.map +1 -0
- package/build/cjs/index.js +37 -633
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/react.js +644 -0
- package/build/cjs/react.js.map +1 -0
- package/build/cjs/scroll-restoration.js +2 -2
- package/build/cjs/scroll-restoration.js.map +1 -1
- package/build/esm/index.js +44 -44
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +158 -121
- package/build/types/index.d.ts +33 -28
- package/build/umd/index.development.js +66 -65
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +4 -4
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -3
- package/src/{deferred.tsx → awaited.tsx} +6 -6
- package/src/index.tsx +3 -1180
- package/src/react.tsx +1231 -0
- package/src/scroll-restoration.tsx +1 -1
- package/build/cjs/deferred.js.map +0 -1
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.168",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -43,8 +43,8 @@
|
|
|
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/router-core": "0.0.1-beta.
|
|
47
|
-
"@tanstack/react-store": "0.0.1-beta.
|
|
46
|
+
"@tanstack/router-core": "0.0.1-beta.168",
|
|
47
|
+
"@tanstack/react-store": "0.0.1-beta.168"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DeferredPromise, isDehydratedDeferred } from '@tanstack/router-core'
|
|
2
|
-
import { useRouter } from '
|
|
2
|
+
import { useRouter } from './react'
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type AwaitOptions<T> = {
|
|
5
5
|
promise: DeferredPromise<T>
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export function
|
|
8
|
+
export function useAwaited<T>({ promise }: AwaitOptions<T>): [T] {
|
|
9
9
|
const router = useRouter()
|
|
10
10
|
|
|
11
11
|
let state = promise.__deferredState
|
|
@@ -30,11 +30,11 @@ export function useDeferred<T>({ promise }: DeferredOptions<T>): [T] {
|
|
|
30
30
|
return [state.data]
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function
|
|
34
|
-
props:
|
|
33
|
+
export function Await<T>(
|
|
34
|
+
props: AwaitOptions<T> & {
|
|
35
35
|
children: (result: T) => JSX.Element
|
|
36
36
|
},
|
|
37
37
|
) {
|
|
38
|
-
const awaited =
|
|
38
|
+
const awaited = useAwaited(props)
|
|
39
39
|
return props.children(...awaited)
|
|
40
40
|
}
|