@tanstack/react-router 1.168.13 → 1.168.14
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/dist/cjs/Asset.cjs +1 -0
- package/dist/cjs/Asset.cjs.map +1 -1
- package/dist/cjs/CatchBoundary.cjs +1 -0
- package/dist/cjs/CatchBoundary.cjs.map +1 -1
- package/dist/cjs/ClientOnly.cjs +1 -0
- package/dist/cjs/ClientOnly.cjs.map +1 -1
- package/dist/cjs/HeadContent.cjs +1 -0
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/HeadContent.dev.cjs +1 -0
- package/dist/cjs/HeadContent.dev.cjs.map +1 -1
- package/dist/cjs/Match.cjs +6 -5
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/Matches.cjs +4 -3
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/RouterProvider.cjs +1 -0
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/Scripts.cjs +3 -2
- package/dist/cjs/Scripts.cjs.map +1 -1
- package/dist/cjs/Transitioner.cjs +6 -5
- package/dist/cjs/Transitioner.cjs.map +1 -1
- package/dist/cjs/headContentUtils.cjs +1 -1
- package/dist/cjs/headContentUtils.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/index.dev.cjs +1 -0
- package/dist/cjs/link.cjs +2 -1
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/matchContext.cjs +1 -0
- package/dist/cjs/matchContext.cjs.map +1 -1
- package/dist/cjs/not-found.cjs +1 -1
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/routerContext.cjs +1 -0
- package/dist/cjs/routerContext.cjs.map +1 -1
- package/dist/cjs/routerStores.cjs +2 -2
- package/dist/cjs/routerStores.cjs.map +1 -1
- package/dist/cjs/ssr/RouterClient.cjs +1 -1
- package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
- package/dist/cjs/ssr/renderRouterToStream.cjs +2 -2
- package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
- package/dist/cjs/ssr/renderRouterToString.cjs +1 -1
- package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
- package/dist/cjs/useBlocker.cjs +1 -0
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/cjs/useCanGoBack.cjs +1 -1
- package/dist/cjs/useCanGoBack.cjs.map +1 -1
- package/dist/cjs/useLocation.cjs +1 -1
- package/dist/cjs/useLocation.cjs.map +1 -1
- package/dist/cjs/useMatch.cjs +3 -3
- package/dist/cjs/useMatch.cjs.map +1 -1
- package/dist/cjs/useNavigate.cjs +1 -0
- package/dist/cjs/useNavigate.cjs.map +1 -1
- package/dist/cjs/useRouter.cjs +1 -0
- package/dist/cjs/useRouter.cjs.map +1 -1
- package/dist/cjs/useRouterState.cjs +2 -1
- package/dist/cjs/useRouterState.cjs.map +1 -1
- package/dist/cjs/utils.cjs +1 -0
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/esm/Asset.js +1 -0
- package/dist/esm/Asset.js.map +1 -1
- package/dist/esm/CatchBoundary.js +1 -0
- package/dist/esm/CatchBoundary.js.map +1 -1
- package/dist/esm/ClientOnly.js +1 -0
- package/dist/esm/ClientOnly.js.map +1 -1
- package/dist/esm/HeadContent.dev.js +1 -0
- package/dist/esm/HeadContent.dev.js.map +1 -1
- package/dist/esm/HeadContent.js +1 -0
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/Match.js +6 -5
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.js +4 -3
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.js +1 -0
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/Scripts.js +3 -2
- package/dist/esm/Scripts.js.map +1 -1
- package/dist/esm/Transitioner.js +6 -5
- package/dist/esm/Transitioner.js.map +1 -1
- package/dist/esm/headContentUtils.js +1 -1
- package/dist/esm/headContentUtils.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.dev.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/link.js +2 -1
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/matchContext.js +1 -0
- package/dist/esm/matchContext.js.map +1 -1
- package/dist/esm/not-found.js +1 -1
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/routerContext.js +1 -0
- package/dist/esm/routerContext.js.map +1 -1
- package/dist/esm/routerStores.js +3 -3
- package/dist/esm/routerStores.js.map +1 -1
- package/dist/esm/ssr/RouterClient.js +1 -1
- package/dist/esm/ssr/RouterClient.js.map +1 -1
- package/dist/esm/ssr/renderRouterToStream.js +2 -2
- package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
- package/dist/esm/ssr/renderRouterToString.js +1 -1
- package/dist/esm/ssr/renderRouterToString.js.map +1 -1
- package/dist/esm/useBlocker.js +1 -0
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/esm/useCanGoBack.js +1 -1
- package/dist/esm/useCanGoBack.js.map +1 -1
- package/dist/esm/useLocation.js +1 -1
- package/dist/esm/useLocation.js.map +1 -1
- package/dist/esm/useMatch.js +3 -3
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/esm/useNavigate.js +1 -0
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useRouter.js +1 -0
- package/dist/esm/useRouter.js.map +1 -1
- package/dist/esm/useRouterState.js +2 -1
- package/dist/esm/useRouterState.js.map +1 -1
- package/dist/esm/utils.js +1 -0
- package/dist/esm/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/Asset.tsx +2 -0
- package/src/CatchBoundary.tsx +2 -0
- package/src/ClientOnly.tsx +2 -0
- package/src/HeadContent.dev.tsx +2 -0
- package/src/HeadContent.tsx +2 -0
- package/src/Match.tsx +8 -6
- package/src/Matches.tsx +5 -3
- package/src/RouterProvider.tsx +2 -0
- package/src/Scripts.tsx +3 -4
- package/src/Transitioner.tsx +10 -10
- package/src/headContentUtils.tsx +1 -1
- package/src/index.dev.tsx +2 -0
- package/src/index.tsx +5 -0
- package/src/link.tsx +3 -1
- package/src/matchContext.tsx +2 -0
- package/src/not-found.tsx +2 -2
- package/src/routerContext.tsx +2 -0
- package/src/routerStores.ts +3 -3
- package/src/ssr/RouterClient.tsx +1 -1
- package/src/ssr/renderRouterToStream.tsx +2 -2
- package/src/ssr/renderRouterToString.tsx +1 -1
- package/src/useBlocker.tsx +2 -0
- package/src/useCanGoBack.ts +1 -1
- package/src/useLocation.tsx +1 -1
- package/src/useMatch.tsx +4 -3
- package/src/useNavigate.tsx +2 -0
- package/src/useRouter.tsx +2 -0
- package/src/useRouterState.tsx +3 -1
- package/src/utils.ts +1 -0
package/src/headContentUtils.tsx
CHANGED
|
@@ -194,7 +194,7 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
|
|
|
194
194
|
return buildTagsFromMatches(
|
|
195
195
|
router,
|
|
196
196
|
nonce,
|
|
197
|
-
router.stores.activeMatchesSnapshot.
|
|
197
|
+
router.stores.activeMatchesSnapshot.get(),
|
|
198
198
|
assetCrossOrigin,
|
|
199
199
|
)
|
|
200
200
|
}
|
package/src/index.dev.tsx
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
export {
|
|
2
4
|
defer,
|
|
3
5
|
isMatch,
|
|
@@ -326,6 +328,9 @@ export type {
|
|
|
326
328
|
InferSelected,
|
|
327
329
|
ValidateUseSearchResult,
|
|
328
330
|
ValidateUseParamsResult,
|
|
331
|
+
SerializerExtensions,
|
|
332
|
+
RegisteredSerializableInput,
|
|
333
|
+
Serializable,
|
|
329
334
|
} from '@tanstack/router-core'
|
|
330
335
|
|
|
331
336
|
export { ScriptOnce } from './ScriptOnce'
|
package/src/link.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import * as React from 'react'
|
|
2
4
|
import { useStore } from '@tanstack/react-store'
|
|
3
5
|
import { flushSync } from 'react-dom'
|
|
@@ -205,7 +207,7 @@ export function useLinkProps<
|
|
|
205
207
|
const isActive = (() => {
|
|
206
208
|
if (externalLink) return false
|
|
207
209
|
|
|
208
|
-
const currentLocation = router.stores.location.
|
|
210
|
+
const currentLocation = router.stores.location.get()
|
|
209
211
|
|
|
210
212
|
const exact = activeOptions?.exact ?? false
|
|
211
213
|
|
package/src/matchContext.tsx
CHANGED
package/src/not-found.tsx
CHANGED
|
@@ -15,8 +15,8 @@ export function CatchNotFound(props: {
|
|
|
15
15
|
const router = useRouter()
|
|
16
16
|
|
|
17
17
|
if (isServer ?? router.isServer) {
|
|
18
|
-
const pathname = router.stores.location.
|
|
19
|
-
const status = router.stores.status.
|
|
18
|
+
const pathname = router.stores.location.get().pathname
|
|
19
|
+
const status = router.stores.status.get()
|
|
20
20
|
const resetKey = `not-found-${pathname}-${status}`
|
|
21
21
|
|
|
22
22
|
return (
|
package/src/routerContext.tsx
CHANGED
package/src/routerStores.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { batch,
|
|
1
|
+
import { batch, createAtom } from '@tanstack/react-store'
|
|
2
2
|
import {
|
|
3
3
|
createNonReactiveMutableStore,
|
|
4
4
|
createNonReactiveReadonlyStore,
|
|
@@ -19,8 +19,8 @@ export const getStoreFactory: GetStoreConfig = (opts) => {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
22
|
-
createMutableStore:
|
|
23
|
-
createReadonlyStore:
|
|
22
|
+
createMutableStore: createAtom,
|
|
23
|
+
createReadonlyStore: createAtom,
|
|
24
24
|
batch: batch,
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/ssr/RouterClient.tsx
CHANGED
|
@@ -7,7 +7,7 @@ let hydrationPromise: Promise<void | Array<Array<void>>> | undefined
|
|
|
7
7
|
|
|
8
8
|
export function RouterClient(props: { router: AnyRouter }) {
|
|
9
9
|
if (!hydrationPromise) {
|
|
10
|
-
if (!props.router.stores.matchesId.
|
|
10
|
+
if (!props.router.stores.matchesId.get().length) {
|
|
11
11
|
hydrationPromise = hydrate(props.router)
|
|
12
12
|
} else {
|
|
13
13
|
hydrationPromise = Promise.resolve()
|
|
@@ -36,7 +36,7 @@ export const renderRouterToStream = async ({
|
|
|
36
36
|
stream as unknown as ReadableStream,
|
|
37
37
|
)
|
|
38
38
|
return new Response(responseStream as any, {
|
|
39
|
-
status: router.stores.statusCode.
|
|
39
|
+
status: router.stores.statusCode.get(),
|
|
40
40
|
headers: responseHeaders,
|
|
41
41
|
})
|
|
42
42
|
}
|
|
@@ -79,7 +79,7 @@ export const renderRouterToStream = async ({
|
|
|
79
79
|
reactAppPassthrough,
|
|
80
80
|
)
|
|
81
81
|
return new Response(responseStream as any, {
|
|
82
|
-
status: router.stores.statusCode.
|
|
82
|
+
status: router.stores.statusCode.get(),
|
|
83
83
|
headers: responseHeaders,
|
|
84
84
|
})
|
|
85
85
|
}
|
package/src/useBlocker.tsx
CHANGED
package/src/useCanGoBack.ts
CHANGED
|
@@ -6,7 +6,7 @@ export function useCanGoBack() {
|
|
|
6
6
|
const router = useRouter()
|
|
7
7
|
|
|
8
8
|
if (isServer ?? router.isServer) {
|
|
9
|
-
return router.stores.location.
|
|
9
|
+
return router.stores.location.get().state.__TSR_index !== 0
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
|
package/src/useLocation.tsx
CHANGED
|
@@ -52,7 +52,7 @@ export function useLocation<
|
|
|
52
52
|
const router = useRouter<TRouter>()
|
|
53
53
|
|
|
54
54
|
if (isServer ?? router.isServer) {
|
|
55
|
-
const location = router.stores.location.
|
|
55
|
+
const location = router.stores.location.get()
|
|
56
56
|
return (
|
|
57
57
|
opts?.select ? opts.select(location as any) : location
|
|
58
58
|
) as UseLocationResult<TRouter, TSelected>
|
package/src/useMatch.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import * as React from 'react'
|
|
2
4
|
import { useStore } from '@tanstack/react-store'
|
|
3
5
|
import { invariant, replaceEqualDeep } from '@tanstack/router-core'
|
|
@@ -19,9 +21,8 @@ import type {
|
|
|
19
21
|
} from '@tanstack/router-core'
|
|
20
22
|
|
|
21
23
|
const dummyStore = {
|
|
22
|
-
state: undefined,
|
|
23
24
|
get: () => undefined,
|
|
24
|
-
subscribe: () => () => {},
|
|
25
|
+
subscribe: () => ({ unsubscribe: () => {} }),
|
|
25
26
|
} as any
|
|
26
27
|
|
|
27
28
|
export interface UseMatchBaseOptions<
|
|
@@ -117,7 +118,7 @@ export function useMatch<
|
|
|
117
118
|
: undefined
|
|
118
119
|
|
|
119
120
|
if (isServer ?? router.isServer) {
|
|
120
|
-
const match = matchStore?.
|
|
121
|
+
const match = matchStore?.get()
|
|
121
122
|
if ((opts.shouldThrow ?? true) && !match) {
|
|
122
123
|
if (process.env.NODE_ENV !== 'production') {
|
|
123
124
|
throw new Error(
|
package/src/useNavigate.tsx
CHANGED
package/src/useRouter.tsx
CHANGED
package/src/useRouterState.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import { useStore } from '@tanstack/react-store'
|
|
2
4
|
import { useRef } from 'react'
|
|
3
5
|
import { replaceEqualDeep } from '@tanstack/router-core'
|
|
@@ -57,7 +59,7 @@ export function useRouterState<
|
|
|
57
59
|
// Avoid subscribing to the store (and any structural sharing work) on the server.
|
|
58
60
|
const _isServer = isServer ?? router.isServer
|
|
59
61
|
if (_isServer) {
|
|
60
|
-
const state = router.stores.__store.
|
|
62
|
+
const state = router.stores.__store.get() as RouterState<
|
|
61
63
|
TRouter['routeTree']
|
|
62
64
|
>
|
|
63
65
|
return (opts?.select ? opts.select(state) : state) as UseRouterStateResult<
|
package/src/utils.ts
CHANGED