@tanstack/solid-router 1.167.5 → 1.168.0

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 (177) hide show
  1. package/dist/cjs/Match.cjs +244 -223
  2. package/dist/cjs/Match.cjs.map +1 -1
  3. package/dist/cjs/Match.d.cts +1 -3
  4. package/dist/cjs/Matches.cjs +32 -31
  5. package/dist/cjs/Matches.cjs.map +1 -1
  6. package/dist/cjs/Scripts.cjs +10 -8
  7. package/dist/cjs/Scripts.cjs.map +1 -1
  8. package/dist/cjs/Scripts.d.cts +2 -1
  9. package/dist/cjs/Transitioner.cjs +26 -26
  10. package/dist/cjs/Transitioner.cjs.map +1 -1
  11. package/dist/cjs/headContentUtils.cjs +15 -15
  12. package/dist/cjs/headContentUtils.cjs.map +1 -1
  13. package/dist/cjs/index.cjs +1 -1
  14. package/dist/cjs/index.dev.cjs +1 -1
  15. package/dist/cjs/link.cjs +119 -84
  16. package/dist/cjs/link.cjs.map +1 -1
  17. package/dist/cjs/matchContext.cjs +7 -5
  18. package/dist/cjs/matchContext.cjs.map +1 -1
  19. package/dist/cjs/matchContext.d.cts +8 -2
  20. package/dist/cjs/not-found.cjs +8 -4
  21. package/dist/cjs/not-found.cjs.map +1 -1
  22. package/dist/cjs/not-found.d.cts +1 -1
  23. package/dist/cjs/router.cjs +2 -1
  24. package/dist/cjs/router.cjs.map +1 -1
  25. package/dist/cjs/routerStores.cjs +67 -0
  26. package/dist/cjs/routerStores.cjs.map +1 -0
  27. package/dist/cjs/routerStores.d.cts +10 -0
  28. package/dist/cjs/ssr/RouterClient.cjs +1 -1
  29. package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
  30. package/dist/cjs/ssr/renderRouterToStream.cjs +1 -1
  31. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
  32. package/dist/cjs/ssr/renderRouterToString.cjs +2 -2
  33. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
  34. package/dist/cjs/ssr/renderRouterToString.d.cts +1 -1
  35. package/dist/cjs/useCanGoBack.cjs +6 -2
  36. package/dist/cjs/useCanGoBack.cjs.map +1 -1
  37. package/dist/cjs/useCanGoBack.d.cts +2 -1
  38. package/dist/cjs/useLoaderDeps.cjs +2 -3
  39. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  40. package/dist/cjs/useLocation.cjs +13 -2
  41. package/dist/cjs/useLocation.cjs.map +1 -1
  42. package/dist/cjs/useMatch.cjs +17 -15
  43. package/dist/cjs/useMatch.cjs.map +1 -1
  44. package/dist/cjs/useParams.cjs +1 -1
  45. package/dist/cjs/useParams.cjs.map +1 -1
  46. package/dist/cjs/useRouterState.cjs +12 -19
  47. package/dist/cjs/useRouterState.cjs.map +1 -1
  48. package/dist/cjs/useSearch.cjs +2 -1
  49. package/dist/cjs/useSearch.cjs.map +1 -1
  50. package/dist/cjs/utils.cjs +0 -14
  51. package/dist/cjs/utils.cjs.map +1 -1
  52. package/dist/cjs/utils.d.cts +0 -4
  53. package/dist/esm/Match.d.ts +1 -3
  54. package/dist/esm/Match.js +245 -224
  55. package/dist/esm/Match.js.map +1 -1
  56. package/dist/esm/Matches.js +34 -33
  57. package/dist/esm/Matches.js.map +1 -1
  58. package/dist/esm/Scripts.d.ts +2 -1
  59. package/dist/esm/Scripts.js +8 -7
  60. package/dist/esm/Scripts.js.map +1 -1
  61. package/dist/esm/Transitioner.js +26 -26
  62. package/dist/esm/Transitioner.js.map +1 -1
  63. package/dist/esm/headContentUtils.js +15 -15
  64. package/dist/esm/headContentUtils.js.map +1 -1
  65. package/dist/esm/index.dev.js +1 -1
  66. package/dist/esm/index.js +1 -1
  67. package/dist/esm/link.js +120 -85
  68. package/dist/esm/link.js.map +1 -1
  69. package/dist/esm/matchContext.d.ts +8 -2
  70. package/dist/esm/matchContext.js +7 -4
  71. package/dist/esm/matchContext.js.map +1 -1
  72. package/dist/esm/not-found.d.ts +1 -1
  73. package/dist/esm/not-found.js +6 -3
  74. package/dist/esm/not-found.js.map +1 -1
  75. package/dist/esm/router.js +2 -1
  76. package/dist/esm/router.js.map +1 -1
  77. package/dist/esm/routerStores.d.ts +10 -0
  78. package/dist/esm/routerStores.js +65 -0
  79. package/dist/esm/routerStores.js.map +1 -0
  80. package/dist/esm/ssr/RouterClient.js +1 -1
  81. package/dist/esm/ssr/RouterClient.js.map +1 -1
  82. package/dist/esm/ssr/renderRouterToStream.js +1 -1
  83. package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
  84. package/dist/esm/ssr/renderRouterToString.d.ts +1 -1
  85. package/dist/esm/ssr/renderRouterToString.js +2 -2
  86. package/dist/esm/ssr/renderRouterToString.js.map +1 -1
  87. package/dist/esm/useCanGoBack.d.ts +2 -1
  88. package/dist/esm/useCanGoBack.js +4 -2
  89. package/dist/esm/useCanGoBack.js.map +1 -1
  90. package/dist/esm/useLoaderDeps.js +2 -3
  91. package/dist/esm/useLoaderDeps.js.map +1 -1
  92. package/dist/esm/useLocation.js +11 -2
  93. package/dist/esm/useLocation.js.map +1 -1
  94. package/dist/esm/useMatch.js +18 -16
  95. package/dist/esm/useMatch.js.map +1 -1
  96. package/dist/esm/useParams.js +1 -1
  97. package/dist/esm/useParams.js.map +1 -1
  98. package/dist/esm/useRouterState.js +10 -18
  99. package/dist/esm/useRouterState.js.map +1 -1
  100. package/dist/esm/useSearch.js +2 -1
  101. package/dist/esm/useSearch.js.map +1 -1
  102. package/dist/esm/utils.d.ts +0 -4
  103. package/dist/esm/utils.js +1 -14
  104. package/dist/esm/utils.js.map +1 -1
  105. package/dist/source/Match.d.ts +1 -3
  106. package/dist/source/Match.jsx +246 -237
  107. package/dist/source/Match.jsx.map +1 -1
  108. package/dist/source/Matches.jsx +42 -44
  109. package/dist/source/Matches.jsx.map +1 -1
  110. package/dist/source/Scripts.d.ts +2 -1
  111. package/dist/source/Scripts.jsx +31 -36
  112. package/dist/source/Scripts.jsx.map +1 -1
  113. package/dist/source/Transitioner.jsx +26 -31
  114. package/dist/source/Transitioner.jsx.map +1 -1
  115. package/dist/source/headContentUtils.jsx +64 -72
  116. package/dist/source/headContentUtils.jsx.map +1 -1
  117. package/dist/source/link.jsx +136 -107
  118. package/dist/source/link.jsx.map +1 -1
  119. package/dist/source/matchContext.d.ts +8 -2
  120. package/dist/source/matchContext.jsx +7 -3
  121. package/dist/source/matchContext.jsx.map +1 -1
  122. package/dist/source/not-found.d.ts +1 -1
  123. package/dist/source/not-found.jsx +6 -5
  124. package/dist/source/not-found.jsx.map +1 -1
  125. package/dist/source/router.js +2 -1
  126. package/dist/source/router.js.map +1 -1
  127. package/dist/source/routerStores.d.ts +10 -0
  128. package/dist/source/routerStores.js +71 -0
  129. package/dist/source/routerStores.js.map +1 -0
  130. package/dist/source/ssr/RouterClient.jsx +1 -1
  131. package/dist/source/ssr/RouterClient.jsx.map +1 -1
  132. package/dist/source/ssr/renderRouterToStream.jsx +1 -1
  133. package/dist/source/ssr/renderRouterToStream.jsx.map +1 -1
  134. package/dist/source/ssr/renderRouterToString.d.ts +1 -1
  135. package/dist/source/ssr/renderRouterToString.jsx +2 -2
  136. package/dist/source/ssr/renderRouterToString.jsx.map +1 -1
  137. package/dist/source/useCanGoBack.d.ts +2 -1
  138. package/dist/source/useCanGoBack.js +4 -2
  139. package/dist/source/useCanGoBack.js.map +1 -1
  140. package/dist/source/useLoaderDeps.jsx +2 -3
  141. package/dist/source/useLoaderDeps.jsx.map +1 -1
  142. package/dist/source/useLocation.jsx +13 -3
  143. package/dist/source/useLocation.jsx.map +1 -1
  144. package/dist/source/useMatch.jsx +30 -27
  145. package/dist/source/useMatch.jsx.map +1 -1
  146. package/dist/source/useParams.jsx +1 -1
  147. package/dist/source/useParams.jsx.map +1 -1
  148. package/dist/source/useRouterState.jsx +12 -33
  149. package/dist/source/useRouterState.jsx.map +1 -1
  150. package/dist/source/useSearch.jsx +2 -1
  151. package/dist/source/useSearch.jsx.map +1 -1
  152. package/dist/source/utils.d.ts +0 -4
  153. package/dist/source/utils.js +0 -13
  154. package/dist/source/utils.js.map +1 -1
  155. package/package.json +2 -3
  156. package/skills/solid-router/SKILL.md +2 -0
  157. package/src/Match.tsx +351 -304
  158. package/src/Matches.tsx +49 -52
  159. package/src/Scripts.tsx +40 -41
  160. package/src/Transitioner.tsx +67 -66
  161. package/src/headContentUtils.tsx +89 -91
  162. package/src/link.tsx +179 -141
  163. package/src/matchContext.tsx +16 -7
  164. package/src/not-found.tsx +6 -6
  165. package/src/router.ts +2 -1
  166. package/src/routerStores.ts +107 -0
  167. package/src/ssr/RouterClient.tsx +1 -1
  168. package/src/ssr/renderRouterToStream.tsx +1 -1
  169. package/src/ssr/renderRouterToString.tsx +2 -2
  170. package/src/useCanGoBack.ts +6 -2
  171. package/src/useLoaderDeps.tsx +2 -3
  172. package/src/useLocation.tsx +18 -5
  173. package/src/useMatch.tsx +36 -43
  174. package/src/useParams.tsx +2 -3
  175. package/src/useRouterState.tsx +17 -41
  176. package/src/useSearch.tsx +2 -1
  177. package/src/utils.ts +0 -20
@@ -1 +1 @@
1
- {"version":3,"file":"Match.js","names":["Solid","invariant","warning","createControlledPromise","getLocationChangeInfo","isNotFound","isRedirect","rootRouteId","isServer","Dynamic","CatchBoundary","ErrorComponent","useRouterState","useRouter","CatchNotFound","matchContext","SafeFragment","renderRouteNotFound","ScrollRestoration","AnyRoute","RootRouteOptions","Match","props","matchId","router","matchState","select","s","match","matches","find","d","id","routeId","ssr","_displayPending","route","routesById","resolvePendingComponent","options","pendingComponent","defaultPendingComponent","routeErrorComponent","errorComponent","defaultErrorComponent","routeOnCatch","onCatch","defaultOnCatch","routeNotFoundComponent","isRoot","notFoundComponent","notFoundRoute","component","resolvedNoSsr","ResolvedSuspenseBoundary","Suspense","ResolvedCatchBoundary","ResolvedNotFoundBoundary","resetKey","loadedAt","parentRouteId","index","findIndex","ShellComponent","shellComponent","_$createComponent","children","Provider","value","fallback","_$memo","undefined","getResetKey","error","Error","_$mergeProps","Switch","when","Show","MatchInner","OnRendered","location","resolvedLocation","state","__TSR_key","createEffect","on","emit","type","remountFn","remountDeps","defaultRemountDeps","loaderDeps","params","_strictParams","search","_strictSearch","key","JSON","stringify","status","_forcePending","componentKey","out","Comp","defaultComponent","Outlet","keyedOut","keyed","_key","_","displayPendingResult","createResource","getMatch","_nonReactive","displayPendingPromise","minPendingResult","minPendingPromise","pendingMinMs","defaultPendingMinMs","routerMatch","setTimeout","resolve","loaderResult","Promise","r","loadPromise","FallbackComponent","_routeId","useContext","parentGlobalNotFound","parentMatch","globalNotFound","childMatchId","v","childMatchStatus","shouldShowNotFound","matchIdAccessor","currentMatchId","createMemo"],"sources":["../../src/Match.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport {\n createControlledPromise,\n getLocationChangeInfo,\n isNotFound,\n isRedirect,\n rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { Dynamic } from 'solid-js/web'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = (props: { matchId: string }) => {\n const router = useRouter()\n const matchState = useRouterState({\n select: (s) => {\n const match = s.matches.find((d) => d.id === props.matchId)\n\n // During navigation transitions, matches can be temporarily removed\n // Return null to avoid errors - the component will handle this gracefully\n if (!match) {\n return null\n }\n\n return {\n routeId: match.routeId,\n ssr: match.ssr,\n _displayPending: match._displayPending,\n }\n },\n })\n\n // If match doesn't exist yet, return null (component is being unmounted or not ready)\n if (!matchState()) return null\n\n const route: () => AnyRoute = () => router.routesById[matchState()!.routeId]\n\n const resolvePendingComponent = () =>\n route().options.pendingComponent ?? router.options.defaultPendingComponent\n\n const routeErrorComponent = () =>\n route().options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = () =>\n route().options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = () =>\n route().isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route().options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route().options.notFoundComponent\n\n const resolvedNoSsr =\n matchState()!.ssr === false || matchState()!.ssr === 'data-only'\n\n const ResolvedSuspenseBoundary = () => Solid.Suspense\n\n const ResolvedCatchBoundary = () =>\n routeErrorComponent() ? CatchBoundary : SafeFragment\n\n const ResolvedNotFoundBoundary = () =>\n routeNotFoundComponent() ? CatchNotFound : SafeFragment\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const parentRouteId = useRouterState({\n select: (s) => {\n const index = s.matches.findIndex((d) => d.id === props.matchId)\n return s.matches[index - 1]?.routeId as string\n },\n })\n\n const ShellComponent = route().isRoot\n ? ((route().options as RootRouteOptions).shellComponent ?? SafeFragment)\n : SafeFragment\n\n return (\n <ShellComponent>\n <matchContext.Provider value={() => props.matchId}>\n <Dynamic\n component={ResolvedSuspenseBoundary()}\n fallback={\n // Don't show fallback on server when using no-ssr mode to avoid hydration mismatch\n (isServer ?? router.isServer) || resolvedNoSsr ? undefined : (\n <Dynamic component={resolvePendingComponent()} />\n )\n }\n >\n <Dynamic\n component={ResolvedCatchBoundary()}\n getResetKey={() => resetKey()}\n errorComponent={routeErrorComponent() || ErrorComponent}\n onCatch={(error: Error) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) throw error\n warning(false, `Error in route match: ${matchState()!.routeId}`)\n routeOnCatch()?.(error)\n }}\n >\n <Dynamic\n component={ResolvedNotFoundBoundary()}\n fallback={(error: any) => {\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent() ||\n (error.routeId && error.routeId !== matchState()!.routeId) ||\n (!error.routeId && !route().isRoot)\n )\n throw error\n\n return (\n <Dynamic component={routeNotFoundComponent()} {...error} />\n )\n }}\n >\n <Solid.Switch>\n <Solid.Match when={resolvedNoSsr}>\n <Solid.Show\n when={!(isServer ?? router.isServer)}\n fallback={<Dynamic component={resolvePendingComponent()} />}\n >\n <MatchInner matchId={props.matchId} />\n </Solid.Show>\n </Solid.Match>\n <Solid.Match when={!resolvedNoSsr}>\n <MatchInner matchId={props.matchId} />\n </Solid.Match>\n </Solid.Switch>\n </Dynamic>\n </Dynamic>\n </Dynamic>\n </matchContext.Provider>\n\n {parentRouteId() === rootRouteId ? (\n <>\n <OnRendered />\n <ScrollRestoration />\n </>\n ) : null}\n </ShellComponent>\n )\n}\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nfunction OnRendered() {\n const router = useRouter()\n\n const location = useRouterState({\n select: (s) => {\n return s.resolvedLocation?.state.__TSR_key\n },\n })\n Solid.createEffect(\n Solid.on([location], () => {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(router.state),\n })\n }),\n )\n return null\n}\n\nexport const MatchInner = (props: { matchId: string }): any => {\n const router = useRouter()\n\n const matchState = useRouterState({\n select: (s) => {\n const match = s.matches.find((d) => d.id === props.matchId)\n\n // During navigation transitions, matches can be temporarily removed\n if (!match) {\n return null\n }\n\n const routeId = match.routeId as string\n\n const remountFn =\n (router.routesById[routeId] as AnyRoute).options.remountDeps ??\n router.options.defaultRemountDeps\n const remountDeps = remountFn?.({\n routeId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n const key = remountDeps ? JSON.stringify(remountDeps) : undefined\n\n return {\n key,\n routeId,\n match: {\n id: match.id,\n status: match.status,\n error: match.error,\n _forcePending: match._forcePending,\n _displayPending: match._displayPending,\n },\n }\n },\n })\n\n if (!matchState()) return null\n\n const route = () => router.routesById[matchState()!.routeId]!\n\n const match = () => matchState()!.match\n\n const componentKey = () => matchState()!.key ?? matchState()!.match.id\n\n const out = () => {\n const Comp = route().options.component ?? router.options.defaultComponent\n if (Comp) {\n return <Comp />\n }\n return <Outlet />\n }\n\n const keyedOut = () => (\n <Solid.Show when={componentKey()} keyed>\n {(_key) => out()}\n </Solid.Show>\n )\n\n return (\n <Solid.Switch>\n <Solid.Match when={match()._displayPending}>\n {(_) => {\n const [displayPendingResult] = Solid.createResource(\n () =>\n router.getMatch(match().id)?._nonReactive.displayPendingPromise,\n )\n\n return <>{displayPendingResult()}</>\n }}\n </Solid.Match>\n <Solid.Match when={match()._forcePending}>\n {(_) => {\n const [minPendingResult] = Solid.createResource(\n () => router.getMatch(match().id)?._nonReactive.minPendingPromise,\n )\n\n return <>{minPendingResult()}</>\n }}\n </Solid.Match>\n <Solid.Match when={match().status === 'pending'}>\n {(_) => {\n const pendingMinMs =\n route().options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n if (pendingMinMs) {\n const routerMatch = router.getMatch(match().id)\n if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {\n // Create a promise that will resolve after the minPendingMs\n if (!(isServer ?? router.isServer)) {\n const minPendingPromise = createControlledPromise<void>()\n\n routerMatch._nonReactive.minPendingPromise = minPendingPromise\n\n setTimeout(() => {\n minPendingPromise.resolve()\n // We've handled the minPendingPromise, so we can delete it\n routerMatch._nonReactive.minPendingPromise = undefined\n }, pendingMinMs)\n }\n }\n }\n\n const [loaderResult] = Solid.createResource(async () => {\n await new Promise((r) => setTimeout(r, 0))\n return router.getMatch(match().id)?._nonReactive.loadPromise\n })\n\n const FallbackComponent =\n route().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return (\n <>\n {FallbackComponent && pendingMinMs > 0 ? (\n <Dynamic component={FallbackComponent} />\n ) : null}\n {loaderResult()}\n </>\n )\n }}\n </Solid.Match>\n <Solid.Match when={match().status === 'notFound'}>\n {(_) => {\n invariant(isNotFound(match().error), 'Expected a notFound error')\n\n // Use Show with keyed to ensure re-render when routeId changes\n return (\n <Solid.Show when={matchState()!.routeId} keyed>\n {(_routeId) =>\n renderRouteNotFound(router, route(), match().error)\n }\n </Solid.Show>\n )\n }}\n </Solid.Match>\n <Solid.Match when={match().status === 'redirected'}>\n {(_) => {\n invariant(isRedirect(match().error), 'Expected a redirect error')\n\n const [loaderResult] = Solid.createResource(async () => {\n await new Promise((r) => setTimeout(r, 0))\n return router.getMatch(match().id)?._nonReactive.loadPromise\n })\n\n return <>{loaderResult()}</>\n }}\n </Solid.Match>\n <Solid.Match when={match().status === 'error'}>\n {(_) => {\n throw match().error\n }}\n </Solid.Match>\n <Solid.Match when={match().status === 'success'}>\n {keyedOut()}\n </Solid.Match>\n </Solid.Switch>\n )\n}\n\nexport const Outlet = () => {\n const router = useRouter()\n const matchId = Solid.useContext(matchContext)\n const routeId = useRouterState({\n select: (s) => s.matches.find((d) => d.id === matchId())?.routeId as string,\n })\n\n const route = () => router.routesById[routeId()]!\n\n const parentGlobalNotFound = useRouterState({\n select: (s) => {\n const matches = s.matches\n const parentMatch = matches.find((d) => d.id === matchId())\n\n // During navigation transitions, parent match can be temporarily removed\n // Return false to avoid errors - the component will handle this gracefully\n if (!parentMatch) {\n return false\n }\n\n return parentMatch.globalNotFound\n },\n })\n\n const childMatchId = useRouterState({\n select: (s) => {\n const matches = s.matches\n const index = matches.findIndex((d) => d.id === matchId())\n const v = matches[index + 1]?.id\n return v\n },\n })\n\n const childMatchStatus = useRouterState({\n select: (s) => {\n const matches = s.matches\n const index = matches.findIndex((d) => d.id === matchId())\n return matches[index + 1]?.status\n },\n })\n\n // Only show not-found if we're not in a redirected state\n const shouldShowNotFound = () =>\n childMatchStatus() !== 'redirected' && parentGlobalNotFound()\n\n return (\n <Solid.Show\n when={!shouldShowNotFound() && childMatchId()}\n fallback={\n <Solid.Show when={shouldShowNotFound()}>\n {renderRouteNotFound(router, route(), undefined)}\n </Solid.Show>\n }\n >\n {(matchIdAccessor) => {\n // Use a memo to avoid stale accessor errors while keeping reactivity\n const currentMatchId = Solid.createMemo(() => matchIdAccessor())\n\n return (\n <Solid.Show\n when={routeId() === rootRouteId}\n fallback={<Match matchId={currentMatchId()} />}\n >\n <Solid.Suspense\n fallback={\n <Dynamic component={router.options.defaultPendingComponent} />\n }\n >\n <Match matchId={currentMatchId()} />\n </Solid.Suspense>\n </Solid.Show>\n )\n }}\n </Solid.Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,IAAaqB,SAASC,UAA+B;CACnD,MAAME,SAASX,WAAW;CAC1B,MAAMY,aAAab,eAAe,EAChCc,SAASC,MAAM;EACb,MAAMC,QAAQD,EAAEE,QAAQC,MAAMC,MAAMA,EAAEC,OAAOV,MAAMC,QAAQ;AAI3D,MAAI,CAACK,MACH,QAAO;AAGT,SAAO;GACLK,SAASL,MAAMK;GACfC,KAAKN,MAAMM;GACXC,iBAAiBP,MAAMO;GACxB;IAEJ,CAAC;AAGF,KAAI,CAACV,YAAY,CAAE,QAAO;CAE1B,MAAMW,cAA8BZ,OAAOa,WAAWZ,YAAY,CAAEQ;CAEpE,MAAMK,gCACJF,OAAO,CAACG,QAAQC,oBAAoBhB,OAAOe,QAAQE;CAErD,MAAMC,4BACJN,OAAO,CAACG,QAAQI,kBAAkBnB,OAAOe,QAAQK;CAEnD,MAAMC,qBACJT,OAAO,CAACG,QAAQO,WAAWtB,OAAOe,QAAQQ;CAE5C,MAAMC,+BACJZ,OAAO,CAACa,SAEHb,OAAO,CAACG,QAAQW,qBACjB1B,OAAOe,QAAQY,eAAeZ,QAAQa,YACtChB,OAAO,CAACG,QAAQW;CAEtB,MAAMG,gBACJ5B,YAAY,CAAES,QAAQ,SAAST,YAAY,CAAES,QAAQ;CAEvD,MAAMoB,iCAAiCtD,MAAMuD;CAE7C,MAAMC,8BACJd,qBAAqB,GAAGhC,gBAAgBM;C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;IAAA,IAACD,OAAI;AAAA,YAAE2D,oBAAoB;;IAAA,IAAAtE,WAAA;AAAA,YACnCjD,oBAAoBO,QAAQY,OAAO,EAAEmC,KAAAA,EAAU;;IAAA,CAAA;;EAAAL,WAIlDuE,oBAAoB;GAEpB,MAAMC,iBAAiB1I,MAAM2I,iBAAiBF,iBAAiB,CAAC;AAEhE,UAAAxE,gBACGjE,MAAM8E,MAAI;IAAA,IACTD,OAAI;AAAA,YAAE5C,SAAS,KAAK1B;;IAAW,IAC/B8D,WAAQ;AAAA,YAAAJ,gBAAG5C,OAAK,EAAA,IAACE,UAAO;AAAA,aAAEmH,gBAAgB;QAAA,CAAA;;IAAA,IAAAxE,WAAA;AAAA,YAAAD,gBAEzCjE,MAAMuD,UAAQ;MAAA,IACbc,WAAQ;AAAA,cAAAJ,gBACLxD,SAAO,EAAA,IAAC2C,YAAS;AAAA,eAAE5B,OAAOe,QAAQE;UAAuB,CAAA;;MAAA,IAAAyB,WAAA;AAAA,cAAAD,gBAG3D5C,OAAK,EAAA,IAACE,UAAO;AAAA,eAAEmH,gBAAgB;UAAA,CAAA;;MAAA,CAAA;;IAAA,CAAA;;EAIvC,CAAA"}
1
+ {"version":3,"file":"Match.js","names":["Solid","invariant","warning","createControlledPromise","getLocationChangeInfo","isNotFound","isRedirect","rootRouteId","isServer","Dynamic","CatchBoundary","ErrorComponent","useRouter","CatchNotFound","nearestMatchContext","SafeFragment","renderRouteNotFound","ScrollRestoration","AnyRoute","RootRouteOptions","Match","props","matchId","router","match","createMemo","id","undefined","stores","activeMatchStoresById","get","state","rawMatchState","currentMatch","routeId","parentRouteId","routesById","parentRoute","ssr","_displayPending","hasPendingMatch","currentRouteId","Boolean","pendingRouteIds","nearestMatch","hasPending","_$createComponent","Show","when","children","currentMatchState","route","resolvePendingComponent","options","pendingComponent","defaultPendingComponent","routeErrorComponent","errorComponent","defaultErrorComponent","routeOnCatch","onCatch","defaultOnCatch","routeNotFoundComponent","isRoot","notFoundComponent","notFoundRoute","component","resolvedNoSsr","ResolvedSuspenseBoundary","Suspense","ResolvedCatchBoundary","ResolvedNotFoundBoundary","ShellComponent","shellComponent","Provider","value","fallback","_$memo","getResetKey","loadedAt","error","Error","_$mergeProps","Switch","MatchInner","OnRendered","location","resolvedLocation","__TSR_key","createEffect","on","emit","type","useContext","remountFn","remountDeps","defaultRemountDeps","loaderDeps","params","_strictParams","search","_strictSearch","key","JSON","stringify","status","_forcePending","componentKey","out","Comp","defaultComponent","Outlet","keyedOut","keyed","_key","_","displayPendingResult","createResource","getMatch","_nonReactive","displayPendingPromise","minPendingResult","minPendingPromise","pendingMinMs","defaultPendingMinMs","routerMatch","setTimeout","resolve","loaderResult","Promise","r","loadPromise","FallbackComponent","_routeId","RouteErrorComponent","info","componentStack","nearestParentMatch","parentMatch","parentGlobalNotFound","globalNotFound","childMatchId","childMatchIdByRouteId","childMatchStatus","shouldShowNotFound","resolvedRoute","childMatchIdAccessor","currentMatchId"],"sources":["../../src/Match.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport {\n createControlledPromise,\n getLocationChangeInfo,\n isNotFound,\n isRedirect,\n rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { Dynamic } from 'solid-js/web'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { nearestMatchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = (props: { matchId: string }) => {\n const router = useRouter()\n\n const match = Solid.createMemo(() => {\n const id = props.matchId\n if (!id) return undefined\n return router.stores.activeMatchStoresById.get(id)?.state\n })\n\n const rawMatchState = Solid.createMemo(() => {\n const currentMatch = match()\n if (!currentMatch) {\n return null\n }\n\n const routeId = currentMatch.routeId as string\n const parentRouteId = (router.routesById[routeId] as AnyRoute)?.parentRoute\n ?.id\n\n return {\n matchId: currentMatch.id,\n routeId,\n ssr: currentMatch.ssr,\n _displayPending: currentMatch._displayPending,\n parentRouteId: parentRouteId as string | undefined,\n }\n })\n\n const hasPendingMatch = Solid.createMemo(() => {\n const currentRouteId = rawMatchState()?.routeId\n return currentRouteId\n ? Boolean(router.stores.pendingRouteIds.state[currentRouteId])\n : false\n })\n const nearestMatch = {\n matchId: () => rawMatchState()?.matchId,\n routeId: () => rawMatchState()?.routeId,\n match,\n hasPending: hasPendingMatch,\n }\n\n return (\n <Solid.Show when={rawMatchState()}>\n {(currentMatchState) => {\n const route: () => AnyRoute = () =>\n router.routesById[currentMatchState().routeId]\n\n const resolvePendingComponent = () =>\n route().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const routeErrorComponent = () =>\n route().options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = () =>\n route().options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = () =>\n route().isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route().options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route().options.notFoundComponent\n\n const resolvedNoSsr =\n currentMatchState().ssr === false ||\n currentMatchState().ssr === 'data-only'\n\n const ResolvedSuspenseBoundary = () => Solid.Suspense\n\n const ResolvedCatchBoundary = () =>\n routeErrorComponent() ? CatchBoundary : SafeFragment\n\n const ResolvedNotFoundBoundary = () =>\n routeNotFoundComponent() ? CatchNotFound : SafeFragment\n\n const ShellComponent = route().isRoot\n ? ((route().options as RootRouteOptions).shellComponent ??\n SafeFragment)\n : SafeFragment\n\n return (\n <ShellComponent>\n <nearestMatchContext.Provider value={nearestMatch}>\n <Dynamic\n component={ResolvedSuspenseBoundary()}\n fallback={\n // Don't show fallback on server when using no-ssr mode to avoid hydration mismatch\n (isServer ?? router.isServer) && resolvedNoSsr ? undefined : (\n <Dynamic component={resolvePendingComponent()} />\n )\n }\n >\n <Dynamic\n component={ResolvedCatchBoundary()}\n getResetKey={() => router.stores.loadedAt.state}\n errorComponent={routeErrorComponent() || ErrorComponent}\n onCatch={(error: Error) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) throw error\n warning(\n false,\n `Error in route match: ${currentMatchState().routeId}`,\n )\n routeOnCatch()?.(error)\n }}\n >\n <Dynamic\n component={ResolvedNotFoundBoundary()}\n fallback={(error: any) => {\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent() ||\n (error.routeId &&\n error.routeId !== currentMatchState().routeId) ||\n (!error.routeId && !route().isRoot)\n )\n throw error\n\n return (\n <Dynamic\n component={routeNotFoundComponent()}\n {...error}\n />\n )\n }}\n >\n <Solid.Switch>\n <Solid.Match when={resolvedNoSsr}>\n <Solid.Show\n when={!(isServer ?? router.isServer)}\n fallback={\n <Dynamic component={resolvePendingComponent()} />\n }\n >\n <MatchInner />\n </Solid.Show>\n </Solid.Match>\n <Solid.Match when={!resolvedNoSsr}>\n <MatchInner />\n </Solid.Match>\n </Solid.Switch>\n </Dynamic>\n </Dynamic>\n </Dynamic>\n </nearestMatchContext.Provider>\n\n {currentMatchState().parentRouteId === rootRouteId ? (\n <>\n <OnRendered />\n <ScrollRestoration />\n </>\n ) : null}\n </ShellComponent>\n )\n }}\n </Solid.Show>\n )\n}\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nfunction OnRendered() {\n const router = useRouter()\n\n const location = Solid.createMemo(\n () => router.stores.resolvedLocation.state?.state.__TSR_key,\n )\n Solid.createEffect(\n Solid.on([location], () => {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n }),\n )\n return null\n}\n\nexport const MatchInner = (): any => {\n const router = useRouter()\n const match = Solid.useContext(nearestMatchContext).match\n\n const rawMatchState = Solid.createMemo(() => {\n const currentMatch = match()\n if (!currentMatch) {\n return null\n }\n\n const routeId = currentMatch.routeId as string\n\n const remountFn =\n (router.routesById[routeId] as AnyRoute).options.remountDeps ??\n router.options.defaultRemountDeps\n const remountDeps = remountFn?.({\n routeId,\n loaderDeps: currentMatch.loaderDeps,\n params: currentMatch._strictParams,\n search: currentMatch._strictSearch,\n })\n const key = remountDeps ? JSON.stringify(remountDeps) : undefined\n\n return {\n key,\n routeId,\n match: {\n id: currentMatch.id,\n status: currentMatch.status,\n error: currentMatch.error,\n _forcePending: currentMatch._forcePending ?? false,\n _displayPending: currentMatch._displayPending ?? false,\n },\n }\n })\n\n return (\n <Solid.Show when={rawMatchState()}>\n {(currentMatchState) => {\n const route = () => router.routesById[currentMatchState().routeId]!\n\n const currentMatch = () => currentMatchState().match\n\n const componentKey = () =>\n currentMatchState().key ?? currentMatchState().match.id\n\n const out = () => {\n const Comp =\n route().options.component ?? router.options.defaultComponent\n if (Comp) {\n return <Comp />\n }\n return <Outlet />\n }\n\n const keyedOut = () => (\n <Solid.Show when={componentKey()} keyed>\n {(_key) => out()}\n </Solid.Show>\n )\n\n return (\n <Solid.Switch>\n <Solid.Match when={currentMatch()._displayPending}>\n {(_) => {\n const [displayPendingResult] = Solid.createResource(\n () =>\n router.getMatch(currentMatch().id)?._nonReactive\n .displayPendingPromise,\n )\n\n return <>{displayPendingResult()}</>\n }}\n </Solid.Match>\n <Solid.Match when={currentMatch()._forcePending}>\n {(_) => {\n const [minPendingResult] = Solid.createResource(\n () =>\n router.getMatch(currentMatch().id)?._nonReactive\n .minPendingPromise,\n )\n\n return <>{minPendingResult()}</>\n }}\n </Solid.Match>\n <Solid.Match when={currentMatch().status === 'pending'}>\n {(_) => {\n const pendingMinMs =\n route().options.pendingMinMs ??\n router.options.defaultPendingMinMs\n\n if (pendingMinMs) {\n const routerMatch = router.getMatch(currentMatch().id)\n if (\n routerMatch &&\n !routerMatch._nonReactive.minPendingPromise\n ) {\n // Create a promise that will resolve after the minPendingMs\n if (!(isServer ?? router.isServer)) {\n const minPendingPromise = createControlledPromise<void>()\n\n routerMatch._nonReactive.minPendingPromise =\n minPendingPromise\n\n setTimeout(() => {\n minPendingPromise.resolve()\n // We've handled the minPendingPromise, so we can delete it\n routerMatch._nonReactive.minPendingPromise = undefined\n }, pendingMinMs)\n }\n }\n }\n\n const [loaderResult] = Solid.createResource(async () => {\n await new Promise((r) => setTimeout(r, 0))\n return router.getMatch(currentMatch().id)?._nonReactive\n .loadPromise\n })\n\n const FallbackComponent =\n route().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return (\n <>\n {FallbackComponent && pendingMinMs > 0 ? (\n <Dynamic component={FallbackComponent} />\n ) : null}\n {loaderResult()}\n </>\n )\n }}\n </Solid.Match>\n <Solid.Match when={currentMatch().status === 'notFound'}>\n {(_) => {\n invariant(\n isNotFound(currentMatch().error),\n 'Expected a notFound error',\n )\n\n // Use Show with keyed to ensure re-render when routeId changes\n return (\n <Solid.Show when={currentMatchState().routeId} keyed>\n {(_routeId) =>\n renderRouteNotFound(router, route(), currentMatch().error)\n }\n </Solid.Show>\n )\n }}\n </Solid.Match>\n <Solid.Match when={currentMatch().status === 'redirected'}>\n {(_) => {\n invariant(\n isRedirect(currentMatch().error),\n 'Expected a redirect error',\n )\n\n const [loaderResult] = Solid.createResource(async () => {\n await new Promise((r) => setTimeout(r, 0))\n return router.getMatch(currentMatch().id)?._nonReactive\n .loadPromise\n })\n\n return <>{loaderResult()}</>\n }}\n </Solid.Match>\n <Solid.Match when={currentMatch().status === 'error'}>\n {(_) => {\n if (isServer ?? router.isServer) {\n const RouteErrorComponent =\n (route().options.errorComponent ??\n router.options.defaultErrorComponent) ||\n ErrorComponent\n\n return (\n <RouteErrorComponent\n error={currentMatch().error}\n info={{\n componentStack: '',\n }}\n />\n )\n }\n\n throw currentMatch().error\n }}\n </Solid.Match>\n <Solid.Match when={currentMatch().status === 'success'}>\n {keyedOut()}\n </Solid.Match>\n </Solid.Switch>\n )\n }}\n </Solid.Show>\n )\n}\n\nexport const Outlet = () => {\n const router = useRouter()\n const nearestParentMatch = Solid.useContext(nearestMatchContext)\n const parentMatch = nearestParentMatch.match\n const routeId = nearestParentMatch.routeId\n const route = Solid.createMemo(() =>\n routeId() ? router.routesById[routeId()!] : undefined,\n )\n\n const parentGlobalNotFound = Solid.createMemo(\n () => parentMatch()?.globalNotFound ?? false,\n )\n\n const childMatchId = Solid.createMemo(() => {\n const currentRouteId = routeId()\n return currentRouteId\n ? router.stores.childMatchIdByRouteId.state[currentRouteId]\n : undefined\n })\n\n const childMatchStatus = Solid.createMemo(() => {\n const id = childMatchId()\n if (!id) return undefined\n return router.stores.activeMatchStoresById.get(id)?.state.status\n })\n\n // Only show not-found if we're not in a redirected state\n const shouldShowNotFound = () =>\n childMatchStatus() !== 'redirected' && parentGlobalNotFound()\n\n return (\n <Solid.Show\n when={!shouldShowNotFound() && childMatchId()}\n fallback={\n <Solid.Show when={shouldShowNotFound() && route()}>\n {(resolvedRoute) =>\n renderRouteNotFound(router, resolvedRoute(), undefined)\n }\n </Solid.Show>\n }\n >\n {(childMatchIdAccessor) => {\n const currentMatchId = Solid.createMemo(() => childMatchIdAccessor())\n\n return (\n <Solid.Show\n when={routeId() === rootRouteId}\n fallback={<Match matchId={currentMatchId()} />}\n >\n <Solid.Suspense\n fallback={\n <Dynamic component={router.options.defaultPendingComponent} />\n }\n >\n <Match matchId={currentMatchId()} />\n </Solid.Suspense>\n </Solid.Show>\n )\n }}\n </Solid.Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAaoB,SAASC,UAA+B;CACnD,MAAME,SAASX,WAAW;CAE1B,MAAMY,QAAQxB,MAAMyB,iBAAiB;EACnC,MAAMC,KAAKL,MAAMC;A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,CAAA,EAAA,IAAI7F,OAAO;;IAAAF,WAC7CgG,kBACAjI,oBAAoBO,QAAQ0H,eAAe,EAAEtH,KAAAA,EAAS;IAAC,CAAA;;EAAAsB,WAK3DiG,yBAAyB;GACzB,MAAMC,iBAAiBnJ,MAAMyB,iBAAiByH,sBAAsB,CAAC;AAErE,UAAApG,gBACG9C,MAAM+C,MAAI;IAAA,IACTC,OAAI;AAAA,YAAEd,SAAS,KAAK3B;;IAAW,IAC/BqE,WAAQ;AAAA,YAAA9B,gBAAG1B,OAAK,EAAA,IAACE,UAAO;AAAA,aAAE6H,gBAAgB;QAAA,CAAA;;IAAA,IAAAlG,WAAA;AAAA,YAAAH,gBAEzC9C,MAAMqE,UAAQ;MAAA,IACbO,WAAQ;AAAA,cAAA9B,gBACLrC,SAAO,EAAA,IAACyD,YAAS;AAAA,eAAE3C,OAAO8B,QAAQE;UAAuB,CAAA;;MAAA,IAAAN,WAAA;AAAA,cAAAH,gBAG3D1B,OAAK,EAAA,IAACE,UAAO;AAAA,eAAE6H,gBAAgB;UAAA,CAAA;;MAAA,CAAA;;IAAA,CAAA;;EAIvC,CAAA"}
@@ -1,11 +1,10 @@
1
1
  import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
2
2
  import { useRouter } from "./useRouter.js";
3
- import { useRouterState } from "./useRouterState.js";
4
- import { matchContext } from "./matchContext.js";
3
+ import { nearestMatchContext } from "./matchContext.js";
5
4
  import { Transitioner } from "./Transitioner.js";
6
5
  import { SafeFragment } from "./SafeFragment.js";
7
6
  import { Match } from "./Match.js";
8
- import { rootRouteId } from "@tanstack/router-core";
7
+ import { replaceEqualDeep, rootRouteId } from "@tanstack/router-core";
9
8
  import { createComponent, memo } from "solid-js/web";
10
9
  import * as Solid from "solid-js";
11
10
  import warning from "tiny-warning";
@@ -29,10 +28,17 @@ function Matches() {
29
28
  }
30
29
  function MatchesInner() {
31
30
  const router = useRouter();
32
- const matchId = useRouterState({ select: (s) => {
33
- return s.matches[0]?.id;
34
- } });
35
- const resetKey = useRouterState({ select: (s) => s.loadedAt });
31
+ const matchId = () => router.stores.firstMatchId.state;
32
+ const routeId = () => matchId() ? rootRouteId : void 0;
33
+ const match = () => routeId() ? router.stores.getMatchStoreByRouteId(rootRouteId).state : void 0;
34
+ const hasPendingMatch = () => routeId() ? Boolean(router.stores.pendingRouteIds.state[rootRouteId]) : false;
35
+ const resetKey = () => router.stores.loadedAt.state;
36
+ const nearestMatch = {
37
+ matchId,
38
+ routeId,
39
+ match,
40
+ hasPending: hasPendingMatch
41
+ };
36
42
  const matchComponent = () => {
37
43
  return createComponent(Solid.Show, {
38
44
  get when() {
@@ -45,16 +51,15 @@ function MatchesInner() {
45
51
  }
46
52
  });
47
53
  };
48
- return createComponent(matchContext.Provider, {
49
- value: matchId,
54
+ return createComponent(nearestMatchContext.Provider, {
55
+ value: nearestMatch,
50
56
  get children() {
51
57
  return memo(() => !!router.options.disableGlobalCatchBoundary)() ? matchComponent() : createComponent(CatchBoundary, {
52
58
  getResetKey: () => resetKey(),
53
59
  errorComponent: ErrorComponent,
54
60
  get onCatch() {
55
61
  return process.env.NODE_ENV !== "production" ? (error) => {
56
- warning(false, `The following error wasn't caught by any route! At the very leas
57
- t, consider setting an 'errorComponent' in your RootRoute!`);
62
+ warning(false, `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`);
58
63
  warning(false, error.message || error.toString());
59
64
  } : void 0;
60
65
  },
@@ -67,11 +72,10 @@ function MatchesInner() {
67
72
  }
68
73
  function useMatchRoute() {
69
74
  const router = useRouter();
70
- const status = useRouterState({ select: (s) => s.status });
71
75
  return (opts) => {
72
- const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts;
73
76
  return Solid.createMemo(() => {
74
- status();
77
+ const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts;
78
+ router.stores.matchRouteReactivity.state;
75
79
  return router.matchRoute(rest, {
76
80
  pending,
77
81
  caseSensitive,
@@ -82,35 +86,32 @@ function useMatchRoute() {
82
86
  };
83
87
  }
84
88
  function MatchRoute(props) {
85
- const status = useRouterState({ select: (s) => s.status });
86
- return createComponent(Solid.Show, {
87
- get when() {
88
- return status();
89
- },
90
- keyed: true,
91
- children: (_) => {
92
- const params = useMatchRoute()(props)();
93
- const child = props.children;
94
- if (typeof child === "function") return child(params);
95
- return params ? child : null;
96
- }
97
- });
89
+ const params = useMatchRoute()(props);
90
+ return memo(Solid.createMemo(() => {
91
+ const matchedParams = params();
92
+ const child = props.children;
93
+ if (typeof child === "function") return child(matchedParams);
94
+ return matchedParams ? child : null;
95
+ }));
98
96
  }
99
97
  function useMatches(opts) {
100
- return useRouterState({ select: (state) => {
101
- const matches = state.matches;
102
- return opts?.select ? opts.select(matches) : matches;
103
- } });
98
+ const router = useRouter();
99
+ return Solid.createMemo((prev) => {
100
+ const matches = router.stores.activeMatchesSnapshot.state;
101
+ const res = opts?.select ? opts.select(matches) : matches;
102
+ if (prev === void 0) return res;
103
+ return replaceEqualDeep(prev, res);
104
+ });
104
105
  }
105
106
  function useParentMatches(opts) {
106
- const contextMatchId = Solid.useContext(matchContext);
107
+ const contextMatchId = Solid.useContext(nearestMatchContext).matchId;
107
108
  return useMatches({ select: (matches) => {
108
109
  matches = matches.slice(0, matches.findIndex((d) => d.id === contextMatchId()));
109
110
  return opts?.select ? opts.select(matches) : matches;
110
111
  } });
111
112
  }
112
113
  function useChildMatches(opts) {
113
- const contextMatchId = Solid.useContext(matchContext);
114
+ const contextMatchId = Solid.useContext(nearestMatchContext).matchId;
114
115
  return useMatches({ select: (matches) => {
115
116
  matches = matches.slice(matches.findIndex((d) => d.id === contextMatchId()) + 1);
116
117
  return opts?.select ? opts.select(matches) : matches;
@@ -1 +1 @@
1
- {"version":3,"file":"Matches.js","names":["Solid","warning","rootRouteId","isServer","CatchBoundary","ErrorComponent","useRouterState","useRouter","Transitioner","matchContext","SafeFragment","Match","AnyRoute","AnyRouter","DeepPartial","Expand","MakeOptionalPathParams","MakeOptionalSearchParams","MakeRouteMatchUnion","MaskOptions","MatchRouteOptions","NoInfer","RegisteredRouter","ResolveRelativePath","ResolveRoute","RouteByPath","RouterState","ToSubOptionsProps","RouteMatchExtensions","meta","Array","JSX","IntrinsicElements","links","scripts","styles","headScripts","Matches","router","ResolvedSuspense","document","ssr","Suspense","rootRoute","routesById","PendingComponent","options","pendingComponent","defaultPendingComponent","OptionalWrapper","InnerWrap","_$createComponent","children","fallback","MatchesInner","matchId","select","s","matches","id","resetKey","loadedAt","matchComponent","Show","when","Provider","value","_$memo","disableGlobalCatchBoundary","getResetKey","errorComponent","onCatch","process","env","NODE_ENV","error","message","toString","undefined","UseMatchRouteOptions","TFrom","TRouter","TTo","TMaskFrom","TMaskTo","useMatchRoute","status","opts","Accessor","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MakeMatchRouteOptions","params","Element","MatchRoute","props","keyed","_","child","UseMatchesBaseOptions","TSelected","UseMatchesResult","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const ResolvedSuspense =\n (isServer ?? router.isServer) ||\n (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : Solid.Suspense\n\n const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n const PendingComponent =\n rootRoute().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <ResolvedSuspense\n fallback={PendingComponent ? <PendingComponent /> : null}\n >\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n </OptionalWrapper>\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = () => {\n return (\n <Solid.Show when={matchId()}>\n <Match matchId={matchId()!} />\n </Solid.Show>\n )\n }\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent()\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={\n process.env.NODE_ENV !== 'production'\n ? (error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very leas\n t, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }\n : undefined\n }\n >\n {matchComponent()}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // 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\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n const child = props.children\n if (typeof child === 'function') {\n return (child as any)(params)\n }\n\n return params ? child : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches)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AAErD,QAAOkG,WAAW,EAChBnD,SAASE,YAAiD;AACxDA,YAAUA,QAAQsD,MAChB,GACAtD,QAAQuD,WAAWC,MAAMA,EAAEvD,OAAOmD,gBAAgB,CACpD,CAAC;AACD,SAAOvB,MAAM/B,SAAS+B,KAAK/B,OAAOE,QAAQ,GAAGA;IAEhD,CAAQ;;AAGX,SAAgByD,gBAId5B,MACsD;CACtD,MAAMuB,iBAAiB9G,MAAM+G,WAAWtG,aAAa;AAErD,QAAOkG,WAAW,EAChBnD,SAASE,YAAiD;AACxDA,YAAUA,QAAQsD,MAChBtD,QAAQuD,WAAWC,MAAMA,EAAEvD,OAAOmD,gBAAgB,CAAC,GAAG,EACvD;AACD,SAAOvB,MAAM/B,SAAS+B,KAAK/B,OAAOE,QAAQ,GAAGA;IAEhD,CAAQ"}
1
+ {"version":3,"file":"Matches.js","names":["Solid","warning","replaceEqualDeep","rootRouteId","isServer","CatchBoundary","ErrorComponent","useRouter","Transitioner","nearestMatchContext","SafeFragment","Match","AnyRoute","AnyRouter","DeepPartial","Expand","MakeOptionalPathParams","MakeOptionalSearchParams","MakeRouteMatchUnion","MaskOptions","MatchRouteOptions","NoInfer","RegisteredRouter","ResolveRelativePath","ResolveRoute","RouteByPath","ToSubOptionsProps","RouteMatchExtensions","meta","Array","JSX","IntrinsicElements","links","scripts","styles","headScripts","Matches","router","ResolvedSuspense","document","ssr","Suspense","rootRoute","routesById","PendingComponent","options","pendingComponent","defaultPendingComponent","OptionalWrapper","InnerWrap","_$createComponent","children","fallback","MatchesInner","matchId","stores","firstMatchId","state","routeId","undefined","match","getMatchStoreByRouteId","hasPendingMatch","Boolean","pendingRouteIds","resetKey","loadedAt","nearestMatch","hasPending","matchComponent","Show","when","Provider","value","_$memo","disableGlobalCatchBoundary","getResetKey","errorComponent","onCatch","process","env","NODE_ENV","error","message","toString","UseMatchRouteOptions","TFrom","TRouter","TTo","TMaskFrom","TMaskTo","useMatchRoute","opts","Accessor","createMemo","pending","caseSensitive","fuzzy","includeSearch","rest","matchRouteReactivity","matchRoute","MakeMatchRouteOptions","params","Element","MatchRoute","props","renderedChild","matchedParams","child","UseMatchesBaseOptions","select","matches","TSelected","UseMatchesResult","useMatches","prev","activeMatchesSnapshot","res","useParentMatches","contextMatchId","useContext","slice","findIndex","d","id","useChildMatches"],"sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { replaceEqualDeep, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { nearestMatchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const ResolvedSuspense =\n (isServer ?? router.isServer) ||\n (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : Solid.Suspense\n\n const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n const PendingComponent =\n rootRoute().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <ResolvedSuspense\n fallback={PendingComponent ? <PendingComponent /> : null}\n >\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n </OptionalWrapper>\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = () => router.stores.firstMatchId.state\n const routeId = () => (matchId() ? rootRouteId : undefined)\n const match = () =>\n routeId()\n ? router.stores.getMatchStoreByRouteId(rootRouteId).state\n : undefined\n const hasPendingMatch = () =>\n routeId()\n ? Boolean(router.stores.pendingRouteIds.state[rootRouteId])\n : false\n const resetKey = () => router.stores.loadedAt.state\n const nearestMatch = {\n matchId,\n routeId,\n match,\n hasPending: hasPendingMatch,\n }\n\n const matchComponent = () => {\n return (\n <Solid.Show when={matchId()}>\n <Match matchId={matchId()!} />\n </Solid.Show>\n )\n }\n\n return (\n <nearestMatchContext.Provider value={nearestMatch}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent()\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={\n process.env.NODE_ENV !== 'production'\n ? (error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }\n : undefined\n }\n >\n {matchComponent()}\n </CatchBoundary>\n )}\n </nearestMatchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n > => {\n return Solid.createMemo(() => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n router.stores.matchRouteReactivity.state\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // 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\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)\n\n const renderedChild = Solid.createMemo(() => {\n const matchedParams = params()\n const child = props.children\n\n if (typeof child === 'function') {\n return (child as any)(matchedParams)\n }\n\n return matchedParams ? child : null\n })\n\n return <>{renderedChild()}</>\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const router = useRouter<TRouter>()\n return Solid.createMemo((prev: TSelected | undefined) => {\n const matches = router.stores.activeMatchesSnapshot.state as Array<\n MakeRouteMatchUnion<TRouter>\n >\n const res = opts?.select ? opts.select(matches) : matches\n if (prev === undefined) return res\n return replaceEqualDeep(prev, res) as any\n }) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(nearestMatchContext).matchId\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(nearestMatchContext).matchId\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,SAAgBoC,UAAU;CACxB,MAAMC,SAAS9B,WAAW;CAE1B,MAAM+B,oBACHlC,YAAYiC,OAAOjC,aACnB,OAAOmC,aAAa,eAAeF,OAAOG,MACvC9B,eACAV,MAAMyC;CAEZ,MAAMC,kBAAkCL,OAAOM,WAAWxC;CAC1D,MAAMyC,mB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YAAUA,QAAQU,MAChB,GACAV,QAAQW,WAAWC,MAAMA,EAAEC,OAAOL,gBAAgB,CACpD,CAAC;AACD,SAAO5B,MAAMmB,SAASnB,KAAKmB,OAAOC,QAAQ,GAAGA;IAEhD,CAAQ;;AAGX,SAAgBc,gBAIdlC,MACsD;CACtD,MAAM4B,iBAAiBxH,MAAMyH,WAAWhH,oBAAoB,CAAC6C;AAE7D,QAAO6D,WAAW,EAChBJ,SAASC,YAAiD;AACxDA,YAAUA,QAAQU,MAChBV,QAAQW,WAAWC,MAAMA,EAAEC,OAAOL,gBAAgB,CAAC,GAAG,EACvD;AACD,SAAO5B,MAAMmB,SAASnB,KAAKmB,OAAOC,QAAQ,GAAGA;IAEhD,CAAQ"}
@@ -1 +1,2 @@
1
- export declare const Scripts: () => import("solid-js").JSX.Element;
1
+ import * as Solid from 'solid-js';
2
+ export declare const Scripts: () => Solid.JSX.Element;
@@ -1,16 +1,17 @@
1
1
  import { useRouter } from "./useRouter.js";
2
- import { useRouterState } from "./useRouterState.js";
3
2
  import { Asset } from "./Asset.js";
4
3
  import { createComponent, memo } from "solid-js/web";
4
+ import * as Solid from "solid-js";
5
5
  //#region src/Scripts.tsx
6
6
  var Scripts = () => {
7
7
  const router = useRouter();
8
8
  const nonce = router.options.ssr?.nonce;
9
- const assetScripts = useRouterState({ select: (state) => {
9
+ const activeMatches = Solid.createMemo(() => router.stores.activeMatchesSnapshot.state);
10
+ const assetScripts = Solid.createMemo(() => {
10
11
  const assetScripts = [];
11
12
  const manifest = router.ssr?.manifest;
12
13
  if (!manifest) return [];
13
- state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach((route) => manifest.routes[route.id]?.assets?.filter((d) => d.tag === "script").forEach((asset) => {
14
+ activeMatches().map((match) => router.looseRoutesById[match.routeId]).forEach((route) => manifest.routes[route.id]?.assets?.filter((d) => d.tag === "script").forEach((asset) => {
14
15
  assetScripts.push({
15
16
  tag: "script",
16
17
  attrs: {
@@ -21,18 +22,18 @@ var Scripts = () => {
21
22
  });
22
23
  }));
23
24
  return assetScripts;
24
- } });
25
- const scripts = useRouterState({ select: (state) => ({ scripts: state.matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
25
+ });
26
+ const scripts = Solid.createMemo(() => activeMatches().map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
26
27
  tag: "script",
27
28
  attrs: {
28
29
  ...script,
29
30
  nonce
30
31
  },
31
32
  children
32
- })) }) });
33
+ })));
33
34
  let serverBufferedScript = void 0;
34
35
  if (router.serverSsr) serverBufferedScript = router.serverSsr.takeBufferedScripts();
35
- const allScripts = [...scripts().scripts, ...assetScripts()];
36
+ const allScripts = [...scripts(), ...assetScripts()];
36
37
  if (serverBufferedScript) allScripts.unshift(serverBufferedScript);
37
38
  return memo(() => allScripts.map((asset, i) => createComponent(Asset, asset)));
38
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Scripts.js","names":["Asset","useRouterState","useRouter","RouterManagedTag","Scripts","router","nonce","options","ssr","assetScripts","select","state","Array","manifest","matches","map","match","looseRoutesById","routeId","forEach","route","routes","id","assets","filter","d","tag","asset","push","attrs","children","scripts","flat","Boolean","script","serverBufferedScript","undefined","serverSsr","takeBufferedScripts","allScripts","unshift","_$memo","i","_$createComponent"],"sources":["../../src/Scripts.tsx"],"sourcesContent":["import { Asset } from './Asset'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const Scripts = () => {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const assetScripts = useRouterState({\n select: (state) => {\n const assetScripts: Array<RouterManagedTag> = []\n const manifest = router.ssr?.manifest\n\n if (!manifest) {\n return []\n }\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n manifest.routes[route.id]?.assets\n ?.filter((d) => d.tag === 'script')\n .forEach((asset) => {\n assetScripts.push({\n tag: 'script',\n attrs: { ...asset.attrs, nonce },\n children: asset.children,\n } as any)\n }),\n )\n\n return assetScripts\n },\n })\n\n const scripts = useRouterState({\n select: (state) => ({\n scripts: (\n state.matches\n .map((match) => match.scripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n nonce,\n },\n children,\n })),\n }),\n })\n\n let serverBufferedScript: RouterManagedTag | undefined = undefined\n\n if (router.serverSsr) {\n serverBufferedScript = router.serverSsr.takeBufferedScripts()\n }\n\n const allScripts = [\n ...scripts().scripts,\n ...assetScripts(),\n ] as Array<RouterManagedTag>\n\n if (serverBufferedScript) {\n allScripts.unshift(serverBufferedScript)\n }\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;AAKA,IAAaI,gBAAgB;CAC3B,MAAMC,SAASH,WAAW;CAC1B,MAAMI,QAAQD,OAAOE,QAAQC,KAAKF;CAClC,MAAMG,eAAeR,eAAe,EAClCS,SAASC,UAAU;EACjB,MAAMF,eAAwC,EAAE;EAChD,MAAMI,WAAWR,OAAOG,KAAKK;AAE7B,MAAI,CAACA,SACH,QAAO,EAAE;AAGXF,QAAMG,QACHC,KAAKC,UAAUX,OAAOY,gBAAgBD,MAAME,SAAU,CACtDC,SAASC,UACRP,SAASQ,OAAOD,MAAME,KAAKC,QACvBC,QAAQC,MAAMA,EAAEC,QAAQ,SAAS,CAClCP,SAASQ,UAAU;AAClBlB,gBAAamB,KAAK;IAChBF,KAAK;IACLG,OAAO;KAAE,GAAGF,MAAME;KAAOvB;KAAO;IAChCwB,UAAUH,MAAMG;IACjB,CAAQ;IAEf,CAAC;AAEH,SAAOrB;IAEV,CAAC;CAEF,MAAMsB,UAAU9B,eAAe,EAC7BS,SAASC,WAAW,EAClBoB,SACEpB,MAAMG,QACHC,KAAKC,UAAUA,MAAMe,QAAS,CAC9BC,KAAK,EAAE,CACPR,OAAOS,QAAQ,CAClBlB,KAAK,EAAEe,UAAU,GAAGI,cAAc;EAClCR,KAAK;EACLG,OAAO;GACL,GAAGK;GACH5B;GACD;EACDwB;EACD,EAAC,EACH,GACF,CAAC;CAEF,IAAIK,uBAAqDC,KAAAA;AAEzD,KAAI/B,OAAOgC,UACTF,wBAAuB9B,OAAOgC,UAAUC,qBAAqB;CAG/D,MAAMC,aAAa,CACjB,GAAGR,SAAS,CAACA,SACb,GAAGtB,cAAc,CAClB;AAED,KAAI0B,qBACFI,YAAWC,QAAQL,qBAAqB;AAG1C,QAAAM,WAEKF,WAAWxB,KAAKY,OAAOe,MAACC,gBACtB3C,OAAU2B,MACZ,CAAC,CAAA"}
1
+ {"version":3,"file":"Scripts.js","names":["Solid","Asset","useRouter","RouterManagedTag","Scripts","router","nonce","options","ssr","activeMatches","createMemo","stores","activeMatchesSnapshot","state","assetScripts","Array","manifest","map","match","looseRoutesById","routeId","forEach","route","routes","id","assets","filter","d","tag","asset","push","attrs","children","scripts","flat","Boolean","script","serverBufferedScript","undefined","serverSsr","takeBufferedScripts","allScripts","unshift","_$memo","i","_$createComponent"],"sources":["../../src/Scripts.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const Scripts = () => {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const activeMatches = Solid.createMemo(\n () => router.stores.activeMatchesSnapshot.state,\n )\n const assetScripts = Solid.createMemo(() => {\n const assetScripts: Array<RouterManagedTag> = []\n const manifest = router.ssr?.manifest\n\n if (!manifest) {\n return []\n }\n\n activeMatches()\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n manifest.routes[route.id]?.assets\n ?.filter((d) => d.tag === 'script')\n .forEach((asset) => {\n assetScripts.push({\n tag: 'script',\n attrs: { ...asset.attrs, nonce },\n children: asset.children,\n } as any)\n }),\n )\n\n return assetScripts\n })\n\n const scripts = Solid.createMemo(() =>\n (\n activeMatches()\n .map((match) => match.scripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n nonce,\n },\n children,\n })),\n )\n\n let serverBufferedScript: RouterManagedTag | undefined = undefined\n\n if (router.serverSsr) {\n serverBufferedScript = router.serverSsr.takeBufferedScripts()\n }\n\n const allScripts = [\n ...scripts(),\n ...assetScripts(),\n ] as Array<RouterManagedTag>\n\n if (serverBufferedScript) {\n allScripts.unshift(serverBufferedScript)\n }\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;AAKA,IAAaI,gBAAgB;CAC3B,MAAMC,SAASH,WAAW;CAC1B,MAAMI,QAAQD,OAAOE,QAAQC,KAAKF;CAClC,MAAMG,gBAAgBT,MAAMU,iBACpBL,OAAOM,OAAOC,sBAAsBC,MAC3C;CACD,MAAMC,eAAed,MAAMU,iBAAiB;EAC1C,MAAMI,eAAwC,EAAE;EAChD,MAAME,WAAWX,OAAOG,KAAKQ;AAE7B,MAAI,CAACA,SACH,QAAO,EAAE;AAGXP,iBAAe,CACZQ,KAAKC,UAAUb,OAAOc,gBAAgBD,MAAME,SAAU,CACtDC,SAASC,UACRN,SAASO,OAAOD,MAAME,KAAKC,QACvBC,QAAQC,MAAMA,EAAEC,QAAQ,SAAS,CAClCP,SAASQ,UAAU;AAClBf,gBAAagB,KAAK;IAChBF,KAAK;IACLG,OAAO;KAAE,GAAGF,MAAME;KAAOzB;KAAO;IAChC0B,UAAUH,MAAMG;IACjB,CAAQ;IAEf,CAAC;AAEH,SAAOlB;GACP;CAEF,MAAMmB,UAAUjC,MAAMU,iBAElBD,eAAe,CACZQ,KAAKC,UAAUA,MAAMe,QAAS,CAC9BC,KAAK,EAAE,CACPR,OAAOS,QAAQ,CAClBlB,KAAK,EAAEe,UAAU,GAAGI,cAAc;EAClCR,KAAK;EACLG,OAAO;GACL,GAAGK;GACH9B;GACD;EACD0B;EACD,EACH,CAAC;CAED,IAAIK,uBAAqDC,KAAAA;AAEzD,KAAIjC,OAAOkC,UACTF,wBAAuBhC,OAAOkC,UAAUC,qBAAqB;CAG/D,MAAMC,aAAa,CACjB,GAAGR,SAAS,EACZ,GAAGnB,cAAc,CAClB;AAED,KAAIuB,qBACFI,YAAWC,QAAQL,qBAAqB;AAG1C,QAAAM,WAEKF,WAAWxB,KAAKY,OAAOe,MAACC,gBACtB5C,OAAU4B,MACZ,CAAC,CAAA"}
@@ -1,6 +1,4 @@
1
1
  import { useRouter } from "./useRouter.js";
2
- import { useRouterState } from "./useRouterState.js";
3
- import { usePrevious } from "./utils.js";
4
2
  import { getLocationChangeInfo, handleHashScroll, trimPathRight } from "@tanstack/router-core";
5
3
  import * as Solid from "solid-js";
6
4
  import { isServer } from "@tanstack/router-core/isServer";
@@ -11,15 +9,12 @@ function Transitioner() {
11
9
  router,
12
10
  mounted: false
13
11
  };
14
- const isLoading = useRouterState({ select: ({ isLoading }) => isLoading });
12
+ const isLoading = Solid.createMemo(() => router.stores.isLoading.state);
15
13
  if (isServer ?? router.isServer) return null;
16
14
  const [isSolidTransitioning, startSolidTransition] = Solid.useTransition();
17
- const hasPendingMatches = useRouterState({ select: (s) => s.matches.some((d) => d.status === "pending") });
18
- const previousIsLoading = usePrevious(isLoading);
19
- const isAnyPending = () => isLoading() || isSolidTransitioning() || hasPendingMatches();
20
- const previousIsAnyPending = usePrevious(isAnyPending);
21
- const isPagePending = () => isLoading() || hasPendingMatches();
22
- const previousIsPagePending = usePrevious(isPagePending);
15
+ const hasPendingMatches = Solid.createMemo(() => router.stores.hasPendingMatches.state);
16
+ const isAnyPending = Solid.createMemo(() => isLoading() || isSolidTransitioning() || hasPendingMatches());
17
+ const isPagePending = Solid.createMemo(() => isLoading() || hasPendingMatches());
23
18
  router.startTransition = (fn) => {
24
19
  Solid.startTransition(() => {
25
20
  startSolidTransition(fn);
@@ -60,33 +55,38 @@ function Transitioner() {
60
55
  tryLoad();
61
56
  });
62
57
  });
63
- Solid.createRenderEffect(Solid.on([previousIsLoading, isLoading], ([previousIsLoading, isLoading]) => {
64
- if (previousIsLoading.previous && !isLoading) router.emit({
58
+ Solid.createRenderEffect((previousIsLoading = false) => {
59
+ const currentIsLoading = isLoading();
60
+ if (previousIsLoading && !currentIsLoading) router.emit({
65
61
  type: "onLoad",
66
- ...getLocationChangeInfo(router.state)
62
+ ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
67
63
  });
68
- }));
69
- Solid.createComputed(Solid.on([isPagePending, previousIsPagePending], ([isPagePending, previousIsPagePending]) => {
70
- if (previousIsPagePending.previous && !isPagePending) router.emit({
64
+ return currentIsLoading;
65
+ });
66
+ Solid.createComputed((previousIsPagePending = false) => {
67
+ const currentIsPagePending = isPagePending();
68
+ if (previousIsPagePending && !currentIsPagePending) router.emit({
71
69
  type: "onBeforeRouteMount",
72
- ...getLocationChangeInfo(router.state)
70
+ ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
73
71
  });
74
- }));
75
- Solid.createRenderEffect(Solid.on([isAnyPending, previousIsAnyPending], ([isAnyPending, previousIsAnyPending]) => {
76
- if (previousIsAnyPending.previous && !isAnyPending) {
77
- const changeInfo = getLocationChangeInfo(router.state);
72
+ return currentIsPagePending;
73
+ });
74
+ Solid.createRenderEffect((previousIsAnyPending = false) => {
75
+ const currentIsAnyPending = isAnyPending();
76
+ if (previousIsAnyPending && !currentIsAnyPending) {
77
+ const changeInfo = getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state);
78
78
  router.emit({
79
79
  type: "onResolved",
80
80
  ...changeInfo
81
81
  });
82
- router.__store.setState((s) => ({
83
- ...s,
84
- status: "idle",
85
- resolvedLocation: s.location
86
- }));
82
+ Solid.batch(() => {
83
+ router.stores.status.setState(() => "idle");
84
+ router.stores.resolvedLocation.setState(() => router.stores.location.state);
85
+ });
87
86
  if (changeInfo.hrefChanged) handleHashScroll(router);
88
87
  }
89
- }));
88
+ return currentIsAnyPending;
89
+ });
90
90
  return null;
91
91
  }
92
92
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"Transitioner.js","names":["Solid","getLocationChangeInfo","handleHashScroll","trimPathRight","isServer","useRouter","useRouterState","usePrevious","Transitioner","router","mountLoadForRouter","mounted","isLoading","select","isSolidTransitioning","startSolidTransition","useTransition","hasPendingMatches","s","matches","some","d","status","previousIsLoading","isAnyPending","previousIsAnyPending","isPagePending","previousIsPagePending","startTransition","fn","Promise","onMount","unsub","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","publicHref","commitLocation","replace","onCleanup","createRenderEffect","untrack","window","ssr","tryLoad","err","console","error","on","previous","emit","type","createComputed","changeInfo","__store","setState","resolvedLocation","location","hrefChanged"],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n if (isServer ?? router.isServer) {\n return null\n }\n\n const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\n // Track pending state changes\n const hasPendingMatches = useRouterState({\n select: (s) => s.matches.some((d) => d.status === 'pending'),\n })\n\n const previousIsLoading = usePrevious(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isSolidTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n router.startTransition = (fn: () => void | Promise<void>) => {\n Solid.startTransition(() => {\n startSolidTransition(fn)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n Solid.onCleanup(() => {\n unsub()\n })\n })\n\n // Try to load the initial location\n Solid.createRenderEffect(() => {\n Solid.untrack(() => {\n if (\n // if we are hydrating from SSR, loading is triggered in ssr-client\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n })\n\n Solid.createRenderEffect(\n Solid.on(\n [previousIsLoading, isLoading],\n ([previousIsLoading, isLoading]) => {\n if (previousIsLoading.previous && !isLoading) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createComputed(\n Solid.on(\n [isPagePending, previousIsPagePending],\n ([isPagePending, previousIsPagePending]) => {\n // emit onBeforeRouteMount\n if (previousIsPagePending.previous && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createRenderEffect(\n Solid.on(\n [isAnyPending, previousIsAnyPending],\n ([isAnyPending, previousIsAnyPending]) => {\n if (previousIsAnyPending.previous && !isAnyPending) {\n const changeInfo = getLocationChangeInfo(router.state)\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if (change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AClB,OAEG,OAAOC,WAAW,eAAe3C,OAAO4C,OACxC3C,mBAAmBD,WAAWA,UAAUC,mBAAmBC,QAE5D;AAEFD,wBAAqB;IAAED;IAAQE,SAAS;IAAM;GAC9C,MAAM2C,UAAU,YAAY;AAC1B,QAAI;AACF,WAAM7C,OAAO0B,MAAM;aACZoB,KAAK;AACZC,aAAQC,MAAMF,IAAI;;;AAGtBD,YAAS;IACT;GACF;AAEFtD,OAAMkD,mBACJlD,MAAM0D,GACJ,CAACnC,mBAAmBX,UAAU,GAC7B,CAACW,mBAAmBX,eAAe;AAClC,MAAIW,kBAAkBoC,YAAY,CAAC/C,UACjCH,QAAOmD,KAAK;GACVC,MAAM;GACN,GAAG5D,sBAAsBQ,OAAOmC,MAAK;GACtC,CAAC;GAIV,CAAC;AAED5C,OAAM8D,eACJ9D,MAAM0D,GACJ,CAAChC,eAAeC,sBAAsB,GACrC,CAACD,eAAeC,2BAA2B;AAE1C,MAAIA,sBAAsBgC,YAAY,CAACjC,cACrCjB,QAAOmD,KAAK;GACVC,MAAM;GACN,GAAG5D,sBAAsBQ,OAAOmC,MAAK;GACtC,CAAC;GAIV,CAAC;AAED5C,OAAMkD,mBACJlD,MAAM0D,GACJ,CAAClC,cAAcC,qBAAqB,GACnC,CAACD,cAAcC,0BAA0B;AACxC,MAAIA,qBAAqBkC,YAAY,CAACnC,cAAc;GAClD,MAAMuC,aAAa9D,sBAAsBQ,OAAOmC,MAAM;AACtDnC,UAAOmD,KAAK;IACVC,MAAM;IACN,GAAGE;IACJ,CAAC;AAEFtD,UAAOuD,QAAQC,UAAU/C,OAAO;IAC9B,GAAGA;IACHI,QAAQ;IACR4C,kBAAkBhD,EAAEiD;IACrB,EAAE;AAEH,OAAIJ,WAAWK,YACblE,kBAAiBO,OAAO;;GAKlC,CAAC;AAED,QAAO"}
1
+ {"version":3,"file":"Transitioner.js","names":["Solid","getLocationChangeInfo","handleHashScroll","trimPathRight","isServer","useRouter","Transitioner","router","mountLoadForRouter","mounted","isLoading","createMemo","stores","state","isSolidTransitioning","startSolidTransition","useTransition","hasPendingMatches","isAnyPending","isPagePending","startTransition","fn","Promise","onMount","unsub","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","_includeValidateSearch","publicHref","commitLocation","replace","onCleanup","createRenderEffect","untrack","window","ssr","tryLoad","err","console","error","previousIsLoading","currentIsLoading","emit","type","location","resolvedLocation","createComputed","previousIsPagePending","currentIsPagePending","previousIsAnyPending","currentIsAnyPending","changeInfo","batch","status","setState","hrefChanged"],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = Solid.createMemo(() => router.stores.isLoading.state)\n\n if (isServer ?? router.isServer) {\n return null\n }\n\n const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\n // Track pending state changes\n const hasPendingMatches = Solid.createMemo(\n () => router.stores.hasPendingMatches.state,\n )\n\n const isAnyPending = Solid.createMemo(\n () => isLoading() || isSolidTransitioning() || hasPendingMatches(),\n )\n\n const isPagePending = Solid.createMemo(\n () => isLoading() || hasPendingMatches(),\n )\n\n router.startTransition = (fn: () => void | Promise<void>) => {\n Solid.startTransition(() => {\n startSolidTransition(fn)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n Solid.onCleanup(() => {\n unsub()\n })\n })\n\n // Try to load the initial location\n Solid.createRenderEffect(() => {\n Solid.untrack(() => {\n if (\n // if we are hydrating from SSR, loading is triggered in ssr-client\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n })\n\n Solid.createRenderEffect((previousIsLoading = false) => {\n const currentIsLoading = isLoading()\n\n if (previousIsLoading && !currentIsLoading) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n }\n\n return currentIsLoading\n })\n\n Solid.createComputed((previousIsPagePending = false) => {\n const currentIsPagePending = isPagePending()\n\n if (previousIsPagePending && !currentIsPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n }\n\n return currentIsPagePending\n })\n\n Solid.createRenderEffect((previousIsAnyPending = false) => {\n const currentIsAnyPending = isAnyPending()\n\n if (previousIsAnyPending && !currentIsAnyPending) {\n const changeInfo = getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n )\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n Solid.batch(() => {\n router.stores.status.setState(() => 'idle')\n router.stores.resolvedLocation.setState(\n () => router.stores.location.state,\n )\n })\n\n if (changeInfo.hrefChanged) {\n handleHashScroll(router)\n }\n }\n\n return currentIsAnyPending\n })\n\n return null\n}\n"],"mappings":";;;;;AASA,SAAgBM,eAAe;CAC7B,MAAMC,SAASF,WAAW;CAC1B,IAAIG,qBAAqB;EAAED;EAAQE,SAAS;EAAO;CACnD,MAAMC,YAAYV,MAAMW,iBAAiBJ,OAAOK,OAAOF,UAA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B,CAACC,iBACxB3C,QAAO4C,KAAK;GACVC,MAAM;GACN,GAAGnD,sBACDM,OAAOK,OAAOyC,SAASxC,OACvBN,OAAOK,OAAO0C,iBAAiBzC,MACjC;GACD,CAAC;AAGJ,SAAOqC;GACP;AAEFlD,OAAMuD,gBAAgBC,wBAAwB,UAAU;EACtD,MAAMC,uBAAuBtC,eAAe;AAE5C,MAAIqC,yBAAyB,CAACC,qBAC5BlD,QAAO4C,KAAK;GACVC,MAAM;GACN,GAAGnD,sBACDM,OAAOK,OAAOyC,SAASxC,OACvBN,OAAOK,OAAO0C,iBAAiBzC,MACjC;GACD,CAAC;AAGJ,SAAO4C;GACP;AAEFzD,OAAMyC,oBAAoBiB,uBAAuB,UAAU;EACzD,MAAMC,sBAAsBzC,cAAc;AAE1C,MAAIwC,wBAAwB,CAACC,qBAAqB;GAChD,MAAMC,aAAa3D,sBACjBM,OAAOK,OAAOyC,SAASxC,OACvBN,OAAOK,OAAO0C,iBAAiBzC,MAChC;AACDN,UAAO4C,KAAK;IACVC,MAAM;IACN,GAAGQ;IACJ,CAAC;AAEF5D,SAAM6D,YAAY;AAChBtD,WAAOK,OAAOkD,OAAOC,eAAe,OAAO;AAC3CxD,WAAOK,OAAO0C,iBAAiBS,eACvBxD,OAAOK,OAAOyC,SAASxC,MAC9B;KACD;AAEF,OAAI+C,WAAWI,YACb9D,kBAAiBK,OAAO;;AAI5B,SAAOoD;GACP;AAEF,QAAO"}
@@ -1,5 +1,4 @@
1
1
  import { useRouter } from "./useRouter.js";
2
- import { useRouterState } from "./useRouterState.js";
3
2
  import { escapeHtml } from "@tanstack/router-core";
4
3
  import * as Solid from "solid-js";
5
4
  //#region src/headContentUtils.tsx
@@ -10,9 +9,8 @@ import * as Solid from "solid-js";
10
9
  var useTags = () => {
11
10
  const router = useRouter();
12
11
  const nonce = router.options.ssr?.nonce;
13
- const routeMeta = useRouterState({ select: (state) => {
14
- return state.matches.map((match) => match.meta).filter(Boolean);
15
- } });
12
+ const activeMatches = Solid.createMemo(() => router.stores.activeMatchesSnapshot.state);
13
+ const routeMeta = Solid.createMemo(() => activeMatches().map((match) => match.meta).filter(Boolean));
16
14
  const meta = Solid.createMemo(() => {
17
15
  const resultMeta = [];
18
16
  const metaByAttribute = {};
@@ -61,8 +59,9 @@ var useTags = () => {
61
59
  resultMeta.reverse();
62
60
  return resultMeta;
63
61
  });
64
- const links = useRouterState({ select: (state) => {
65
- const constructed = state.matches.map((match) => match.links).filter(Boolean).flat(1).map((link) => ({
62
+ const links = Solid.createMemo(() => {
63
+ const matches = activeMatches();
64
+ const constructed = matches.map((match) => match.links).filter(Boolean).flat(1).map((link) => ({
66
65
  tag: "link",
67
66
  attrs: {
68
67
  ...link,
@@ -70,7 +69,7 @@ var useTags = () => {
70
69
  }
71
70
  }));
72
71
  const manifest = router.ssr?.manifest;
73
- const assets = state.matches.map((match) => manifest?.routes[match.routeId]?.assets ?? []).filter(Boolean).flat(1).filter((asset) => asset.tag === "link").map((asset) => ({
72
+ const assets = matches.map((match) => manifest?.routes[match.routeId]?.assets ?? []).filter(Boolean).flat(1).filter((asset) => asset.tag === "link").map((asset) => ({
74
73
  tag: "link",
75
74
  attrs: {
76
75
  ...asset.attrs,
@@ -78,10 +77,11 @@ var useTags = () => {
78
77
  }
79
78
  }));
80
79
  return [...constructed, ...assets];
81
- } });
82
- const preloadLinks = useRouterState({ select: (state) => {
80
+ });
81
+ const preloadLinks = Solid.createMemo(() => {
82
+ const matches = activeMatches();
83
83
  const preloadLinks = [];
84
- state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach((route) => router.ssr?.manifest?.routes[route.id]?.preloads?.filter(Boolean).forEach((preload) => {
84
+ matches.map((match) => router.looseRoutesById[match.routeId]).forEach((route) => router.ssr?.manifest?.routes[route.id]?.preloads?.filter(Boolean).forEach((preload) => {
85
85
  preloadLinks.push({
86
86
  tag: "link",
87
87
  attrs: {
@@ -92,23 +92,23 @@ var useTags = () => {
92
92
  });
93
93
  }));
94
94
  return preloadLinks;
95
- } });
96
- const styles = useRouterState({ select: (state) => state.matches.map((match) => match.styles).flat(1).filter(Boolean).map(({ children, ...style }) => ({
95
+ });
96
+ const styles = Solid.createMemo(() => activeMatches().map((match) => match.styles).flat(1).filter(Boolean).map(({ children, ...style }) => ({
97
97
  tag: "style",
98
98
  attrs: {
99
99
  ...style,
100
100
  nonce
101
101
  },
102
102
  children
103
- })) });
104
- const headScripts = useRouterState({ select: (state) => state.matches.map((match) => match.headScripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
103
+ })));
104
+ const headScripts = Solid.createMemo(() => activeMatches().map((match) => match.headScripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
105
105
  tag: "script",
106
106
  attrs: {
107
107
  ...script,
108
108
  nonce
109
109
  },
110
110
  children
111
- })) });
111
+ })));
112
112
  return () => uniqBy([
113
113
  ...meta(),
114
114
  ...preloadLinks(),