@tanstack/solid-router 1.168.11 → 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.
Files changed (109) hide show
  1. package/dist/cjs/Match.cjs +7 -7
  2. package/dist/cjs/Match.cjs.map +1 -1
  3. package/dist/cjs/Matches.cjs +6 -6
  4. package/dist/cjs/Matches.cjs.map +1 -1
  5. package/dist/cjs/Matches.d.cts +2 -2
  6. package/dist/cjs/Scripts.cjs +1 -1
  7. package/dist/cjs/Scripts.cjs.map +1 -1
  8. package/dist/cjs/Transitioner.cjs +7 -7
  9. package/dist/cjs/Transitioner.cjs.map +1 -1
  10. package/dist/cjs/headContentUtils.cjs +1 -1
  11. package/dist/cjs/headContentUtils.cjs.map +1 -1
  12. package/dist/cjs/link.cjs +1 -1
  13. package/dist/cjs/link.cjs.map +1 -1
  14. package/dist/cjs/not-found.cjs +2 -2
  15. package/dist/cjs/not-found.cjs.map +1 -1
  16. package/dist/cjs/routerStores.cjs +6 -11
  17. package/dist/cjs/routerStores.cjs.map +1 -1
  18. package/dist/cjs/ssr/RouterClient.cjs +1 -1
  19. package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
  20. package/dist/cjs/ssr/renderRouterToStream.cjs +1 -1
  21. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
  22. package/dist/cjs/ssr/renderRouterToString.cjs +1 -1
  23. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
  24. package/dist/cjs/useCanGoBack.cjs +1 -1
  25. package/dist/cjs/useCanGoBack.cjs.map +1 -1
  26. package/dist/cjs/useLocation.cjs +2 -2
  27. package/dist/cjs/useLocation.cjs.map +1 -1
  28. package/dist/cjs/useMatch.cjs +2 -2
  29. package/dist/cjs/useMatch.cjs.map +1 -1
  30. package/dist/cjs/useRouterState.cjs +3 -3
  31. package/dist/cjs/useRouterState.cjs.map +1 -1
  32. package/dist/esm/Match.js +7 -7
  33. package/dist/esm/Match.js.map +1 -1
  34. package/dist/esm/Matches.d.ts +2 -2
  35. package/dist/esm/Matches.js +6 -6
  36. package/dist/esm/Matches.js.map +1 -1
  37. package/dist/esm/Scripts.js +1 -1
  38. package/dist/esm/Scripts.js.map +1 -1
  39. package/dist/esm/Transitioner.js +7 -7
  40. package/dist/esm/Transitioner.js.map +1 -1
  41. package/dist/esm/headContentUtils.js +1 -1
  42. package/dist/esm/headContentUtils.js.map +1 -1
  43. package/dist/esm/link.js +1 -1
  44. package/dist/esm/link.js.map +1 -1
  45. package/dist/esm/not-found.js +2 -2
  46. package/dist/esm/not-found.js.map +1 -1
  47. package/dist/esm/routerStores.js +6 -11
  48. package/dist/esm/routerStores.js.map +1 -1
  49. package/dist/esm/ssr/RouterClient.js +1 -1
  50. package/dist/esm/ssr/RouterClient.js.map +1 -1
  51. package/dist/esm/ssr/renderRouterToStream.js +1 -1
  52. package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
  53. package/dist/esm/ssr/renderRouterToString.js +1 -1
  54. package/dist/esm/ssr/renderRouterToString.js.map +1 -1
  55. package/dist/esm/useCanGoBack.js +1 -1
  56. package/dist/esm/useCanGoBack.js.map +1 -1
  57. package/dist/esm/useLocation.js +2 -2
  58. package/dist/esm/useLocation.js.map +1 -1
  59. package/dist/esm/useMatch.js +2 -2
  60. package/dist/esm/useMatch.js.map +1 -1
  61. package/dist/esm/useRouterState.js +3 -3
  62. package/dist/esm/useRouterState.js.map +1 -1
  63. package/dist/source/Match.jsx +7 -7
  64. package/dist/source/Match.jsx.map +1 -1
  65. package/dist/source/Matches.d.ts +2 -2
  66. package/dist/source/Matches.jsx +6 -6
  67. package/dist/source/Matches.jsx.map +1 -1
  68. package/dist/source/Scripts.jsx +1 -1
  69. package/dist/source/Scripts.jsx.map +1 -1
  70. package/dist/source/Transitioner.jsx +7 -7
  71. package/dist/source/Transitioner.jsx.map +1 -1
  72. package/dist/source/headContentUtils.jsx +1 -1
  73. package/dist/source/headContentUtils.jsx.map +1 -1
  74. package/dist/source/link.jsx +1 -1
  75. package/dist/source/link.jsx.map +1 -1
  76. package/dist/source/not-found.jsx +2 -2
  77. package/dist/source/not-found.jsx.map +1 -1
  78. package/dist/source/routerStores.js +4 -13
  79. package/dist/source/routerStores.js.map +1 -1
  80. package/dist/source/ssr/RouterClient.jsx +1 -1
  81. package/dist/source/ssr/RouterClient.jsx.map +1 -1
  82. package/dist/source/ssr/renderRouterToStream.jsx +1 -1
  83. package/dist/source/ssr/renderRouterToStream.jsx.map +1 -1
  84. package/dist/source/ssr/renderRouterToString.jsx +1 -1
  85. package/dist/source/ssr/renderRouterToString.jsx.map +1 -1
  86. package/dist/source/useCanGoBack.js +1 -1
  87. package/dist/source/useCanGoBack.js.map +1 -1
  88. package/dist/source/useLocation.jsx +2 -2
  89. package/dist/source/useLocation.jsx.map +1 -1
  90. package/dist/source/useMatch.jsx +3 -3
  91. package/dist/source/useMatch.jsx.map +1 -1
  92. package/dist/source/useRouterState.jsx +3 -3
  93. package/dist/source/useRouterState.jsx.map +1 -1
  94. package/package.json +2 -2
  95. package/src/Match.tsx +8 -8
  96. package/src/Matches.tsx +9 -13
  97. package/src/Scripts.tsx +2 -2
  98. package/src/Transitioner.tsx +11 -13
  99. package/src/headContentUtils.tsx +2 -2
  100. package/src/link.tsx +1 -1
  101. package/src/not-found.tsx +2 -2
  102. package/src/routerStores.ts +4 -13
  103. package/src/ssr/RouterClient.tsx +1 -1
  104. package/src/ssr/renderRouterToStream.tsx +1 -1
  105. package/src/ssr/renderRouterToString.tsx +1 -1
  106. package/src/useCanGoBack.ts +1 -1
  107. package/src/useLocation.tsx +2 -2
  108. package/src/useMatch.tsx +3 -3
  109. package/src/useRouterState.tsx +3 -3
@@ -12,16 +12,16 @@ export function useRouterState(opts) {
12
12
  // implementation does not provide subscribe() semantics.
13
13
  const _isServer = isServer ?? router.isServer;
14
14
  if (_isServer) {
15
- const state = router.stores.__store.state;
15
+ const state = router.stores.__store.get();
16
16
  const selected = (opts?.select ? opts.select(state) : state);
17
17
  return (() => selected);
18
18
  }
19
19
  if (!opts?.select) {
20
- return (() => router.stores.__store.state);
20
+ return (() => router.stores.__store.get());
21
21
  }
22
22
  const select = opts.select;
23
23
  return Solid.createMemo((prev) => {
24
- const res = select(router.stores.__store.state);
24
+ const res = select(router.stores.__store.get());
25
25
  if (prev === undefined)
26
26
  return res;
27
27
  return replaceEqualDeep(prev, res);
@@ -1 +1 @@
1
- {"version":3,"file":"useRouterState.jsx","sourceRoot":"","sources":["../../src/useRouterState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAkBvC,MAAM,UAAU,cAAc,CAI5B,IAAgD;IAEhD,MAAM,aAAa,GAAG,SAAS,CAAU;QACvC,IAAI,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS;KACjC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,aAAa,CAAA;IAE5C,gEAAgE;IAChE,sEAAsE;IACtE,yDAAyD;IACzD,MAAM,SAAS,GAAG,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAA;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAEnC,CAAA;QACD,MAAM,QAAQ,GAAG,CACf,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CACE,CAAA;QAC7C,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAErB,CAAA;IACH,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAExC,CAAA;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,IAA2B,EAAE,EAAE;QACtD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC/C,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,GAAG,CAAA;QAClC,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAuD,CAAA;AAC1D,CAAC"}
1
+ {"version":3,"file":"useRouterState.jsx","sourceRoot":"","sources":["../../src/useRouterState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAkBvC,MAAM,UAAU,cAAc,CAI5B,IAAgD;IAEhD,MAAM,aAAa,GAAG,SAAS,CAAU;QACvC,IAAI,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS;KACjC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,aAAa,CAAA;IAE5C,gEAAgE;IAChE,sEAAsE;IACtE,yDAAyD;IACzD,MAAM,SAAS,GAAG,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAA;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAEtC,CAAA;QACD,MAAM,QAAQ,GAAG,CACf,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CACE,CAAA;QAC7C,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAErB,CAAA;IACH,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAExC,CAAA;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,IAA2B,EAAE,EAAE;QACtD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAC/C,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,GAAG,CAAA;QAClC,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACpC,CAAC,CAAuD,CAAA;AAC1D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-router",
3
- "version": "1.168.11",
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.9"
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)?.state
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.state[currentRouteId])
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.state}
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.state?.state.__TSR_key,
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.state,
213
- router.stores.resolvedLocation.state,
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.state[currentRouteId]
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)?.state.status
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
@@ -17,11 +17,8 @@ import type {
17
17
  MakeRouteMatchUnion,
18
18
  MaskOptions,
19
19
  MatchRouteOptions,
20
- NoInfer,
21
20
  RegisteredRouter,
22
- ResolveRelativePath,
23
21
  ResolveRoute,
24
- RouteByPath,
25
22
  ToSubOptionsProps,
26
23
  } from '@tanstack/router-core'
27
24
 
@@ -65,17 +62,17 @@ export function Matches() {
65
62
 
66
63
  function MatchesInner() {
67
64
  const router = useRouter()
68
- const matchId = () => router.stores.firstMatchId.state
65
+ const matchId = () => router.stores.firstMatchId.get()
69
66
  const routeId = () => (matchId() ? rootRouteId : undefined)
70
67
  const match = () =>
71
68
  routeId()
72
- ? router.stores.getMatchStoreByRouteId(rootRouteId).state
69
+ ? router.stores.getMatchStoreByRouteId(rootRouteId).get()
73
70
  : undefined
74
71
  const hasPendingMatch = () =>
75
72
  routeId()
76
- ? Boolean(router.stores.pendingRouteIds.state[rootRouteId])
73
+ ? Boolean(router.stores.pendingRouteIds.get()[rootRouteId])
77
74
  : false
78
- const resetKey = () => router.stores.loadedAt.state
75
+ const resetKey = () => router.stores.loadedAt.get()
79
76
  const nearestMatch = {
80
77
  matchId,
81
78
  routeId,
@@ -145,7 +142,7 @@ export function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {
145
142
  return Solid.createMemo(() => {
146
143
  const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts
147
144
 
148
- router.stores.matchRouteReactivity.state
145
+ router.stores.matchRouteReactivity.get()
149
146
  return router.matchRoute(rest as any, {
150
147
  pending,
151
148
  caseSensitive,
@@ -166,10 +163,9 @@ export type MakeMatchRouteOptions<
166
163
  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns
167
164
  children?:
168
165
  | ((
169
- params?: RouteByPath<
170
- TRouter['routeTree'],
171
- ResolveRelativePath<TFrom, NoInfer<TTo>>
172
- >['types']['allParams'],
166
+ params?: Expand<
167
+ ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']
168
+ >,
173
169
  ) => Solid.JSX.Element)
174
170
  | Solid.JSX.Element
175
171
  }
@@ -215,7 +211,7 @@ export function useMatches<
215
211
  ): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {
216
212
  const router = useRouter<TRouter>()
217
213
  return Solid.createMemo((prev: TSelected | undefined) => {
218
- const matches = router.stores.activeMatchesSnapshot.state as Array<
214
+ const matches = router.stores.activeMatchesSnapshot.get() as Array<
219
215
  MakeRouteMatchUnion<TRouter>
220
216
  >
221
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
- () => router.stores.activeMatchesSnapshot.state,
9
+ const activeMatches = Solid.createMemo(() =>
10
+ router.stores.activeMatchesSnapshot.get(),
11
11
  )
12
12
  const assetScripts = Solid.createMemo(() => {
13
13
  const assetScripts: Array<RouterManagedTag> = []
@@ -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.state)
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
- () => router.stores.hasPendingMatches.state,
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.state,
99
- router.stores.resolvedLocation.state,
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.state,
115
- router.stores.resolvedLocation.state,
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.state,
129
- router.stores.resolvedLocation.state,
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.setState(() => 'idle')
138
- router.stores.resolvedLocation.setState(
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) {
@@ -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
- () => router.stores.activeMatchesSnapshot.state,
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
@@ -125,7 +125,7 @@ export function useLinkProps<
125
125
  ])
126
126
 
127
127
  const currentLocation = Solid.createMemo(
128
- () => router.stores.location.state,
128
+ () => router.stores.location.get(),
129
129
  undefined,
130
130
  { equals: (prev, next) => prev.href === next.href },
131
131
  )
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.state.pathname)
31
- const status = Solid.createMemo(() => router.stores.status.state)
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
@@ -28,7 +28,7 @@ function initRouterStores(
28
28
  ) => RouterReadableStore<TValue>,
29
29
  ) {
30
30
  stores.childMatchIdByRouteId = createReadonlyStore(() => {
31
- const ids = stores.matchesId.state
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.state
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
  }
@@ -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.state.length) {
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.state,
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.state,
35
+ status: router.stores.statusCode.get(),
36
36
  headers: responseHeaders,
37
37
  })
38
38
  } catch (error) {
@@ -4,6 +4,6 @@ import { useRouter } from './useRouter'
4
4
  export function useCanGoBack() {
5
5
  const router = useRouter()
6
6
  return Solid.createMemo(
7
- () => router.stores.location.state.state.__TSR_index !== 0,
7
+ () => router.stores.location.get().state.__TSR_index !== 0,
8
8
  )
9
9
  }
@@ -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.state) as Accessor<
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.state)
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).state
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.state[opts.from!])
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.state &&
96
+ !router.stores.isTransitioning.get() &&
97
97
  (opts.shouldThrow ?? true)
98
98
  ) {
99
99
  if (process.env.NODE_ENV !== 'production') {
@@ -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.state as RouterState<
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.state) as Accessor<
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.state)
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>>