@tanstack/solid-router 1.168.12 → 1.168.13
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/Match.cjs +7 -7
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/Matches.cjs +6 -6
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Scripts.cjs +1 -1
- package/dist/cjs/Scripts.cjs.map +1 -1
- package/dist/cjs/Transitioner.cjs +7 -7
- 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/link.cjs +1 -1
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/not-found.cjs +2 -2
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/routerStores.cjs +6 -11
- 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 +1 -1
- 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/useCanGoBack.cjs +1 -1
- package/dist/cjs/useCanGoBack.cjs.map +1 -1
- package/dist/cjs/useLocation.cjs +2 -2
- package/dist/cjs/useLocation.cjs.map +1 -1
- package/dist/cjs/useMatch.cjs +2 -2
- package/dist/cjs/useMatch.cjs.map +1 -1
- package/dist/cjs/useRouterState.cjs +3 -3
- package/dist/cjs/useRouterState.cjs.map +1 -1
- package/dist/esm/Match.js +7 -7
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.js +6 -6
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/Scripts.js +1 -1
- package/dist/esm/Scripts.js.map +1 -1
- package/dist/esm/Transitioner.js +7 -7
- 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/link.js +1 -1
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/not-found.js +2 -2
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/routerStores.js +6 -11
- 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 +1 -1
- 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/useCanGoBack.js +1 -1
- package/dist/esm/useCanGoBack.js.map +1 -1
- package/dist/esm/useLocation.js +2 -2
- package/dist/esm/useLocation.js.map +1 -1
- package/dist/esm/useMatch.js +2 -2
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/esm/useRouterState.js +3 -3
- package/dist/esm/useRouterState.js.map +1 -1
- package/dist/source/Match.jsx +7 -7
- package/dist/source/Match.jsx.map +1 -1
- package/dist/source/Matches.jsx +6 -6
- package/dist/source/Matches.jsx.map +1 -1
- package/dist/source/Scripts.jsx +1 -1
- package/dist/source/Scripts.jsx.map +1 -1
- package/dist/source/Transitioner.jsx +7 -7
- package/dist/source/Transitioner.jsx.map +1 -1
- package/dist/source/headContentUtils.jsx +1 -1
- package/dist/source/headContentUtils.jsx.map +1 -1
- package/dist/source/link.jsx +1 -1
- package/dist/source/link.jsx.map +1 -1
- package/dist/source/not-found.jsx +2 -2
- package/dist/source/not-found.jsx.map +1 -1
- package/dist/source/routerStores.js +4 -13
- package/dist/source/routerStores.js.map +1 -1
- package/dist/source/ssr/RouterClient.jsx +1 -1
- package/dist/source/ssr/RouterClient.jsx.map +1 -1
- package/dist/source/ssr/renderRouterToStream.jsx +1 -1
- package/dist/source/ssr/renderRouterToStream.jsx.map +1 -1
- package/dist/source/ssr/renderRouterToString.jsx +1 -1
- package/dist/source/ssr/renderRouterToString.jsx.map +1 -1
- package/dist/source/useCanGoBack.js +1 -1
- package/dist/source/useCanGoBack.js.map +1 -1
- package/dist/source/useLocation.jsx +2 -2
- package/dist/source/useLocation.jsx.map +1 -1
- package/dist/source/useMatch.jsx +3 -3
- package/dist/source/useMatch.jsx.map +1 -1
- package/dist/source/useRouterState.jsx +3 -3
- package/dist/source/useRouterState.jsx.map +1 -1
- package/package.json +2 -2
- package/src/Match.tsx +8 -8
- package/src/Matches.tsx +6 -6
- package/src/Scripts.tsx +2 -2
- package/src/Transitioner.tsx +11 -13
- package/src/headContentUtils.tsx +2 -2
- package/src/link.tsx +1 -1
- package/src/not-found.tsx +2 -2
- package/src/routerStores.ts +4 -13
- package/src/ssr/RouterClient.tsx +1 -1
- package/src/ssr/renderRouterToStream.tsx +1 -1
- package/src/ssr/renderRouterToString.tsx +1 -1
- package/src/useCanGoBack.ts +1 -1
- package/src/useLocation.tsx +2 -2
- package/src/useMatch.tsx +3 -3
- package/src/useRouterState.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-router",
|
|
3
|
-
"version": "1.168.
|
|
3
|
+
"version": "1.168.13",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@solidjs/meta": "^0.29.4",
|
|
93
93
|
"isbot": "^5.1.22",
|
|
94
94
|
"@tanstack/history": "1.161.6",
|
|
95
|
-
"@tanstack/router-core": "1.168.
|
|
95
|
+
"@tanstack/router-core": "1.168.10"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@solidjs/testing-library": "^0.8.10",
|
package/src/Match.tsx
CHANGED
|
@@ -24,7 +24,7 @@ export const Match = (props: { matchId: string }) => {
|
|
|
24
24
|
const match = Solid.createMemo(() => {
|
|
25
25
|
const id = props.matchId
|
|
26
26
|
if (!id) return undefined
|
|
27
|
-
return router.stores.activeMatchStoresById.get(id)?.
|
|
27
|
+
return router.stores.activeMatchStoresById.get(id)?.get()
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
const rawMatchState = Solid.createMemo(() => {
|
|
@@ -49,7 +49,7 @@ export const Match = (props: { matchId: string }) => {
|
|
|
49
49
|
const hasPendingMatch = Solid.createMemo(() => {
|
|
50
50
|
const currentRouteId = rawMatchState()?.routeId
|
|
51
51
|
return currentRouteId
|
|
52
|
-
? Boolean(router.stores.pendingRouteIds.
|
|
52
|
+
? Boolean(router.stores.pendingRouteIds.get()[currentRouteId])
|
|
53
53
|
: false
|
|
54
54
|
})
|
|
55
55
|
const nearestMatch = {
|
|
@@ -113,7 +113,7 @@ export const Match = (props: { matchId: string }) => {
|
|
|
113
113
|
>
|
|
114
114
|
<Dynamic
|
|
115
115
|
component={ResolvedCatchBoundary()}
|
|
116
|
-
getResetKey={() => router.stores.loadedAt.
|
|
116
|
+
getResetKey={() => router.stores.loadedAt.get()}
|
|
117
117
|
errorComponent={routeErrorComponent() || ErrorComponent}
|
|
118
118
|
onCatch={(error: Error) => {
|
|
119
119
|
// Forward not found errors (we don't want to show the error component for these)
|
|
@@ -202,15 +202,15 @@ function OnRendered() {
|
|
|
202
202
|
const router = useRouter()
|
|
203
203
|
|
|
204
204
|
const location = Solid.createMemo(
|
|
205
|
-
() => router.stores.resolvedLocation.
|
|
205
|
+
() => router.stores.resolvedLocation.get()?.state.__TSR_key,
|
|
206
206
|
)
|
|
207
207
|
Solid.createEffect(
|
|
208
208
|
Solid.on([location], () => {
|
|
209
209
|
router.emit({
|
|
210
210
|
type: 'onRendered',
|
|
211
211
|
...getLocationChangeInfo(
|
|
212
|
-
router.stores.location.
|
|
213
|
-
router.stores.resolvedLocation.
|
|
212
|
+
router.stores.location.get(),
|
|
213
|
+
router.stores.resolvedLocation.get(),
|
|
214
214
|
),
|
|
215
215
|
})
|
|
216
216
|
}),
|
|
@@ -459,14 +459,14 @@ export const Outlet = () => {
|
|
|
459
459
|
const childMatchId = Solid.createMemo(() => {
|
|
460
460
|
const currentRouteId = routeId()
|
|
461
461
|
return currentRouteId
|
|
462
|
-
? router.stores.childMatchIdByRouteId.
|
|
462
|
+
? router.stores.childMatchIdByRouteId.get()[currentRouteId]
|
|
463
463
|
: undefined
|
|
464
464
|
})
|
|
465
465
|
|
|
466
466
|
const childMatchStatus = Solid.createMemo(() => {
|
|
467
467
|
const id = childMatchId()
|
|
468
468
|
if (!id) return undefined
|
|
469
|
-
return router.stores.activeMatchStoresById.get(id)?.
|
|
469
|
+
return router.stores.activeMatchStoresById.get(id)?.get().status
|
|
470
470
|
})
|
|
471
471
|
|
|
472
472
|
// Only show not-found if we're not in a redirected state
|
package/src/Matches.tsx
CHANGED
|
@@ -62,17 +62,17 @@ export function Matches() {
|
|
|
62
62
|
|
|
63
63
|
function MatchesInner() {
|
|
64
64
|
const router = useRouter()
|
|
65
|
-
const matchId = () => router.stores.firstMatchId.
|
|
65
|
+
const matchId = () => router.stores.firstMatchId.get()
|
|
66
66
|
const routeId = () => (matchId() ? rootRouteId : undefined)
|
|
67
67
|
const match = () =>
|
|
68
68
|
routeId()
|
|
69
|
-
? router.stores.getMatchStoreByRouteId(rootRouteId).
|
|
69
|
+
? router.stores.getMatchStoreByRouteId(rootRouteId).get()
|
|
70
70
|
: undefined
|
|
71
71
|
const hasPendingMatch = () =>
|
|
72
72
|
routeId()
|
|
73
|
-
? Boolean(router.stores.pendingRouteIds.
|
|
73
|
+
? Boolean(router.stores.pendingRouteIds.get()[rootRouteId])
|
|
74
74
|
: false
|
|
75
|
-
const resetKey = () => router.stores.loadedAt.
|
|
75
|
+
const resetKey = () => router.stores.loadedAt.get()
|
|
76
76
|
const nearestMatch = {
|
|
77
77
|
matchId,
|
|
78
78
|
routeId,
|
|
@@ -142,7 +142,7 @@ export function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {
|
|
|
142
142
|
return Solid.createMemo(() => {
|
|
143
143
|
const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts
|
|
144
144
|
|
|
145
|
-
router.stores.matchRouteReactivity.
|
|
145
|
+
router.stores.matchRouteReactivity.get()
|
|
146
146
|
return router.matchRoute(rest as any, {
|
|
147
147
|
pending,
|
|
148
148
|
caseSensitive,
|
|
@@ -211,7 +211,7 @@ export function useMatches<
|
|
|
211
211
|
): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {
|
|
212
212
|
const router = useRouter<TRouter>()
|
|
213
213
|
return Solid.createMemo((prev: TSelected | undefined) => {
|
|
214
|
-
const matches = router.stores.activeMatchesSnapshot.
|
|
214
|
+
const matches = router.stores.activeMatchesSnapshot.get() as Array<
|
|
215
215
|
MakeRouteMatchUnion<TRouter>
|
|
216
216
|
>
|
|
217
217
|
const res = opts?.select ? opts.select(matches) : matches
|
package/src/Scripts.tsx
CHANGED
|
@@ -6,8 +6,8 @@ import type { RouterManagedTag } from '@tanstack/router-core'
|
|
|
6
6
|
export const Scripts = () => {
|
|
7
7
|
const router = useRouter()
|
|
8
8
|
const nonce = router.options.ssr?.nonce
|
|
9
|
-
const activeMatches = Solid.createMemo(
|
|
10
|
-
|
|
9
|
+
const activeMatches = Solid.createMemo(() =>
|
|
10
|
+
router.stores.activeMatchesSnapshot.get(),
|
|
11
11
|
)
|
|
12
12
|
const assetScripts = Solid.createMemo(() => {
|
|
13
13
|
const assetScripts: Array<RouterManagedTag> = []
|
package/src/Transitioner.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { useRouter } from './useRouter'
|
|
|
10
10
|
export function Transitioner() {
|
|
11
11
|
const router = useRouter()
|
|
12
12
|
let mountLoadForRouter = { router, mounted: false }
|
|
13
|
-
const isLoading = Solid.createMemo(() => router.stores.isLoading.
|
|
13
|
+
const isLoading = Solid.createMemo(() => router.stores.isLoading.get())
|
|
14
14
|
|
|
15
15
|
if (isServer ?? router.isServer) {
|
|
16
16
|
return null
|
|
@@ -19,8 +19,8 @@ export function Transitioner() {
|
|
|
19
19
|
const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()
|
|
20
20
|
|
|
21
21
|
// Track pending state changes
|
|
22
|
-
const hasPendingMatches = Solid.createMemo(
|
|
23
|
-
|
|
22
|
+
const hasPendingMatches = Solid.createMemo(() =>
|
|
23
|
+
router.stores.hasPendingMatches.get(),
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
const isAnyPending = Solid.createMemo(
|
|
@@ -95,8 +95,8 @@ export function Transitioner() {
|
|
|
95
95
|
router.emit({
|
|
96
96
|
type: 'onLoad',
|
|
97
97
|
...getLocationChangeInfo(
|
|
98
|
-
router.stores.location.
|
|
99
|
-
router.stores.resolvedLocation.
|
|
98
|
+
router.stores.location.get(),
|
|
99
|
+
router.stores.resolvedLocation.get(),
|
|
100
100
|
),
|
|
101
101
|
})
|
|
102
102
|
}
|
|
@@ -111,8 +111,8 @@ export function Transitioner() {
|
|
|
111
111
|
router.emit({
|
|
112
112
|
type: 'onBeforeRouteMount',
|
|
113
113
|
...getLocationChangeInfo(
|
|
114
|
-
router.stores.location.
|
|
115
|
-
router.stores.resolvedLocation.
|
|
114
|
+
router.stores.location.get(),
|
|
115
|
+
router.stores.resolvedLocation.get(),
|
|
116
116
|
),
|
|
117
117
|
})
|
|
118
118
|
}
|
|
@@ -125,8 +125,8 @@ export function Transitioner() {
|
|
|
125
125
|
|
|
126
126
|
if (previousIsAnyPending && !currentIsAnyPending) {
|
|
127
127
|
const changeInfo = getLocationChangeInfo(
|
|
128
|
-
router.stores.location.
|
|
129
|
-
router.stores.resolvedLocation.
|
|
128
|
+
router.stores.location.get(),
|
|
129
|
+
router.stores.resolvedLocation.get(),
|
|
130
130
|
)
|
|
131
131
|
router.emit({
|
|
132
132
|
type: 'onResolved',
|
|
@@ -134,10 +134,8 @@ export function Transitioner() {
|
|
|
134
134
|
})
|
|
135
135
|
|
|
136
136
|
Solid.batch(() => {
|
|
137
|
-
router.stores.status.
|
|
138
|
-
router.stores.resolvedLocation.
|
|
139
|
-
() => router.stores.location.state,
|
|
140
|
-
)
|
|
137
|
+
router.stores.status.set('idle')
|
|
138
|
+
router.stores.resolvedLocation.set(router.stores.location.get())
|
|
141
139
|
})
|
|
142
140
|
|
|
143
141
|
if (changeInfo.hrefChanged) {
|
package/src/headContentUtils.tsx
CHANGED
|
@@ -18,8 +18,8 @@ import type {
|
|
|
18
18
|
export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
|
|
19
19
|
const router = useRouter()
|
|
20
20
|
const nonce = router.options.ssr?.nonce
|
|
21
|
-
const activeMatches = Solid.createMemo(
|
|
22
|
-
|
|
21
|
+
const activeMatches = Solid.createMemo(() =>
|
|
22
|
+
router.stores.activeMatchesSnapshot.get(),
|
|
23
23
|
)
|
|
24
24
|
const routeMeta = Solid.createMemo(() =>
|
|
25
25
|
activeMatches()
|
package/src/link.tsx
CHANGED
package/src/not-found.tsx
CHANGED
|
@@ -27,8 +27,8 @@ export function CatchNotFound(props: {
|
|
|
27
27
|
}) {
|
|
28
28
|
const router = useRouter()
|
|
29
29
|
// TODO: Some way for the user to programmatically reset the not-found boundary?
|
|
30
|
-
const pathname = Solid.createMemo(() => router.stores.location.
|
|
31
|
-
const status = Solid.createMemo(() => router.stores.status.
|
|
30
|
+
const pathname = Solid.createMemo(() => router.stores.location.get().pathname)
|
|
31
|
+
const status = Solid.createMemo(() => router.stores.status.get())
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<CatchBoundary
|
package/src/routerStores.ts
CHANGED
|
@@ -28,7 +28,7 @@ function initRouterStores(
|
|
|
28
28
|
) => RouterReadableStore<TValue>,
|
|
29
29
|
) {
|
|
30
30
|
stores.childMatchIdByRouteId = createReadonlyStore(() => {
|
|
31
|
-
const ids = stores.matchesId.
|
|
31
|
+
const ids = stores.matchesId.get()
|
|
32
32
|
const obj: Record<string, string> = {}
|
|
33
33
|
for (let i = 0; i < ids.length - 1; i++) {
|
|
34
34
|
const parentStore = stores.activeMatchStoresById.get(ids[i]!)
|
|
@@ -40,7 +40,7 @@ function initRouterStores(
|
|
|
40
40
|
})
|
|
41
41
|
|
|
42
42
|
stores.pendingRouteIds = createReadonlyStore(() => {
|
|
43
|
-
const ids = stores.pendingMatchesId.
|
|
43
|
+
const ids = stores.pendingMatchesId.get()
|
|
44
44
|
const obj: Record<string, boolean> = {}
|
|
45
45
|
for (const id of ids) {
|
|
46
46
|
const store = stores.pendingMatchStoresById.get(id)
|
|
@@ -57,12 +57,7 @@ function createSolidMutableStore<TValue>(
|
|
|
57
57
|
): RouterWritableStore<TValue> {
|
|
58
58
|
const [signal, setSignal] = Solid.createSignal(initialValue)
|
|
59
59
|
|
|
60
|
-
return {
|
|
61
|
-
get state() {
|
|
62
|
-
return signal()
|
|
63
|
-
},
|
|
64
|
-
setState: setSignal,
|
|
65
|
-
}
|
|
60
|
+
return { get: signal, set: setSignal }
|
|
66
61
|
}
|
|
67
62
|
|
|
68
63
|
let finalizationRegistry: FinalizationRegistry<() => void> | null = null
|
|
@@ -78,11 +73,7 @@ function createSolidReadonlyStore<TValue>(
|
|
|
78
73
|
dispose = d
|
|
79
74
|
return Solid.createMemo(read)
|
|
80
75
|
})
|
|
81
|
-
const store = {
|
|
82
|
-
get state() {
|
|
83
|
-
return memo()
|
|
84
|
-
},
|
|
85
|
-
}
|
|
76
|
+
const store = { get: memo }
|
|
86
77
|
finalizationRegistry?.register(store, dispose)
|
|
87
78
|
return store
|
|
88
79
|
}
|
package/src/ssr/RouterClient.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const Dummy = (props: { children?: JSXElement }) => <>{props.children}</>
|
|
|
11
11
|
|
|
12
12
|
export function RouterClient(props: { router: AnyRouter }) {
|
|
13
13
|
if (!hydrationPromise) {
|
|
14
|
-
if (!props.router.stores.matchesId.
|
|
14
|
+
if (!props.router.stores.matchesId.get().length) {
|
|
15
15
|
hydrationPromise = hydrate(props.router)
|
|
16
16
|
} else {
|
|
17
17
|
hydrationPromise = Promise.resolve()
|
|
@@ -52,7 +52,7 @@ export const renderRouterToStream = async ({
|
|
|
52
52
|
readable as unknown as ReadableStream,
|
|
53
53
|
)
|
|
54
54
|
return new Response(responseStream as any, {
|
|
55
|
-
status: router.stores.statusCode.
|
|
55
|
+
status: router.stores.statusCode.get(),
|
|
56
56
|
headers: responseHeaders,
|
|
57
57
|
})
|
|
58
58
|
}
|
|
@@ -32,7 +32,7 @@ export const renderRouterToString = ({
|
|
|
32
32
|
html = html.replace(`</body>`, () => `${injectedHtml}</body>`)
|
|
33
33
|
}
|
|
34
34
|
return new Response(`<!DOCTYPE html>${html}`, {
|
|
35
|
-
status: router.stores.statusCode.
|
|
35
|
+
status: router.stores.statusCode.get(),
|
|
36
36
|
headers: responseHeaders,
|
|
37
37
|
})
|
|
38
38
|
} catch (error) {
|
package/src/useCanGoBack.ts
CHANGED
package/src/useLocation.tsx
CHANGED
|
@@ -28,7 +28,7 @@ export function useLocation<
|
|
|
28
28
|
const router = useRouter<TRouter>()
|
|
29
29
|
|
|
30
30
|
if (!opts?.select) {
|
|
31
|
-
return (() => router.stores.location.
|
|
31
|
+
return (() => router.stores.location.get()) as Accessor<
|
|
32
32
|
UseLocationResult<TRouter, TSelected>
|
|
33
33
|
>
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ export function useLocation<
|
|
|
36
36
|
const select = opts.select
|
|
37
37
|
|
|
38
38
|
return Solid.createMemo((prev: TSelected | undefined) => {
|
|
39
|
-
const res = select(router.stores.location.
|
|
39
|
+
const res = select(router.stores.location.get())
|
|
40
40
|
if (prev === undefined) return res
|
|
41
41
|
return replaceEqualDeep(prev, res)
|
|
42
42
|
}) as Accessor<UseLocationResult<TRouter, TSelected>>
|
package/src/useMatch.tsx
CHANGED
|
@@ -76,7 +76,7 @@ export function useMatch<
|
|
|
76
76
|
|
|
77
77
|
const match = () => {
|
|
78
78
|
if (opts.from) {
|
|
79
|
-
return router.stores.getMatchStoreByRouteId(opts.from).
|
|
79
|
+
return router.stores.getMatchStoreByRouteId(opts.from).get()
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
return nearestMatch?.match()
|
|
@@ -88,12 +88,12 @@ export function useMatch<
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
const hasPendingMatch = opts.from
|
|
91
|
-
? Boolean(router.stores.pendingRouteIds.
|
|
91
|
+
? Boolean(router.stores.pendingRouteIds.get()[opts.from!])
|
|
92
92
|
: (nearestMatch?.hasPending() ?? false)
|
|
93
93
|
|
|
94
94
|
if (
|
|
95
95
|
!hasPendingMatch &&
|
|
96
|
-
!router.stores.isTransitioning.
|
|
96
|
+
!router.stores.isTransitioning.get() &&
|
|
97
97
|
(opts.shouldThrow ?? true)
|
|
98
98
|
) {
|
|
99
99
|
if (process.env.NODE_ENV !== 'production') {
|
package/src/useRouterState.tsx
CHANGED
|
@@ -35,7 +35,7 @@ export function useRouterState<
|
|
|
35
35
|
// implementation does not provide subscribe() semantics.
|
|
36
36
|
const _isServer = isServer ?? router.isServer
|
|
37
37
|
if (_isServer) {
|
|
38
|
-
const state = router.stores.__store.
|
|
38
|
+
const state = router.stores.__store.get() as RouterState<
|
|
39
39
|
TRouter['routeTree']
|
|
40
40
|
>
|
|
41
41
|
const selected = (
|
|
@@ -47,7 +47,7 @@ export function useRouterState<
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (!opts?.select) {
|
|
50
|
-
return (() => router.stores.__store.
|
|
50
|
+
return (() => router.stores.__store.get()) as Accessor<
|
|
51
51
|
UseRouterStateResult<TRouter, TSelected>
|
|
52
52
|
>
|
|
53
53
|
}
|
|
@@ -55,7 +55,7 @@ export function useRouterState<
|
|
|
55
55
|
const select = opts.select
|
|
56
56
|
|
|
57
57
|
return Solid.createMemo((prev: TSelected | undefined) => {
|
|
58
|
-
const res = select(router.stores.__store.
|
|
58
|
+
const res = select(router.stores.__store.get())
|
|
59
59
|
if (prev === undefined) return res
|
|
60
60
|
return replaceEqualDeep(prev, res)
|
|
61
61
|
}) as Accessor<UseRouterStateResult<TRouter, TSelected>>
|