@depup/tanstack__react-router 1.166.4-depup.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 (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/dist/cjs/Asset.cjs +177 -0
  4. package/dist/cjs/Asset.cjs.map +1 -0
  5. package/dist/cjs/Asset.d.cts +5 -0
  6. package/dist/cjs/CatchBoundary.cjs +114 -0
  7. package/dist/cjs/CatchBoundary.cjs.map +1 -0
  8. package/dist/cjs/CatchBoundary.d.cts +12 -0
  9. package/dist/cjs/ClientOnly.cjs +21 -0
  10. package/dist/cjs/ClientOnly.cjs.map +1 -0
  11. package/dist/cjs/ClientOnly.d.cts +49 -0
  12. package/dist/cjs/HeadContent.cjs +15 -0
  13. package/dist/cjs/HeadContent.cjs.map +1 -0
  14. package/dist/cjs/HeadContent.d.cts +6 -0
  15. package/dist/cjs/HeadContent.dev.cjs +41 -0
  16. package/dist/cjs/HeadContent.dev.cjs.map +1 -0
  17. package/dist/cjs/HeadContent.dev.d.cts +10 -0
  18. package/dist/cjs/Match.cjs +255 -0
  19. package/dist/cjs/Match.cjs.map +1 -0
  20. package/dist/cjs/Match.d.cts +14 -0
  21. package/dist/cjs/Matches.cjs +138 -0
  22. package/dist/cjs/Matches.cjs.map +1 -0
  23. package/dist/cjs/Matches.d.cts +68 -0
  24. package/dist/cjs/RouterProvider.cjs +32 -0
  25. package/dist/cjs/RouterProvider.cjs.map +1 -0
  26. package/dist/cjs/RouterProvider.d.cts +23 -0
  27. package/dist/cjs/SafeFragment.cjs +8 -0
  28. package/dist/cjs/SafeFragment.cjs.map +1 -0
  29. package/dist/cjs/SafeFragment.d.cts +1 -0
  30. package/dist/cjs/ScriptOnce.cjs +22 -0
  31. package/dist/cjs/ScriptOnce.cjs.map +1 -0
  32. package/dist/cjs/ScriptOnce.d.cts +6 -0
  33. package/dist/cjs/Scripts.cjs +56 -0
  34. package/dist/cjs/Scripts.cjs.map +1 -0
  35. package/dist/cjs/Scripts.d.cts +5 -0
  36. package/dist/cjs/ScrollRestoration.cjs +38 -0
  37. package/dist/cjs/ScrollRestoration.cjs.map +1 -0
  38. package/dist/cjs/ScrollRestoration.d.cts +14 -0
  39. package/dist/cjs/Transitioner.cjs +119 -0
  40. package/dist/cjs/Transitioner.cjs.map +1 -0
  41. package/dist/cjs/Transitioner.d.cts +1 -0
  42. package/dist/cjs/awaited.cjs +51 -0
  43. package/dist/cjs/awaited.cjs.map +1 -0
  44. package/dist/cjs/awaited.d.cts +14 -0
  45. package/dist/cjs/fileRoute.cjs +109 -0
  46. package/dist/cjs/fileRoute.cjs.map +1 -0
  47. package/dist/cjs/fileRoute.d.cts +87 -0
  48. package/dist/cjs/headContentUtils.cjs +185 -0
  49. package/dist/cjs/headContentUtils.cjs.map +1 -0
  50. package/dist/cjs/headContentUtils.d.cts +7 -0
  51. package/dist/cjs/history.d.cts +8 -0
  52. package/dist/cjs/index.cjs +241 -0
  53. package/dist/cjs/index.cjs.map +1 -0
  54. package/dist/cjs/index.d.cts +51 -0
  55. package/dist/cjs/index.dev.cjs +241 -0
  56. package/dist/cjs/index.dev.cjs.map +1 -0
  57. package/dist/cjs/index.dev.d.cts +2 -0
  58. package/dist/cjs/lazyRouteComponent.cjs +70 -0
  59. package/dist/cjs/lazyRouteComponent.cjs.map +1 -0
  60. package/dist/cjs/lazyRouteComponent.d.cts +11 -0
  61. package/dist/cjs/link.cjs +573 -0
  62. package/dist/cjs/link.cjs.map +1 -0
  63. package/dist/cjs/link.d.cts +98 -0
  64. package/dist/cjs/matchContext.cjs +27 -0
  65. package/dist/cjs/matchContext.cjs.map +1 -0
  66. package/dist/cjs/matchContext.d.cts +3 -0
  67. package/dist/cjs/not-found.cjs +38 -0
  68. package/dist/cjs/not-found.cjs.map +1 -0
  69. package/dist/cjs/not-found.d.cts +9 -0
  70. package/dist/cjs/renderRouteNotFound.cjs +22 -0
  71. package/dist/cjs/renderRouteNotFound.cjs.map +1 -0
  72. package/dist/cjs/renderRouteNotFound.d.cts +10 -0
  73. package/dist/cjs/route.cjs +198 -0
  74. package/dist/cjs/route.cjs.map +1 -0
  75. package/dist/cjs/route.d.cts +142 -0
  76. package/dist/cjs/router.cjs +22 -0
  77. package/dist/cjs/router.cjs.map +1 -0
  78. package/dist/cjs/router.d.cts +83 -0
  79. package/dist/cjs/routerContext.cjs +23 -0
  80. package/dist/cjs/routerContext.cjs.map +1 -0
  81. package/dist/cjs/routerContext.d.cts +3 -0
  82. package/dist/cjs/scroll-restoration.cjs +39 -0
  83. package/dist/cjs/scroll-restoration.cjs.map +1 -0
  84. package/dist/cjs/scroll-restoration.d.cts +1 -0
  85. package/dist/cjs/ssr/RouterClient.cjs +25 -0
  86. package/dist/cjs/ssr/RouterClient.cjs.map +1 -0
  87. package/dist/cjs/ssr/RouterClient.d.cts +4 -0
  88. package/dist/cjs/ssr/RouterServer.cjs +9 -0
  89. package/dist/cjs/ssr/RouterServer.cjs.map +1 -0
  90. package/dist/cjs/ssr/RouterServer.d.cts +4 -0
  91. package/dist/cjs/ssr/client.cjs +12 -0
  92. package/dist/cjs/ssr/client.cjs.map +1 -0
  93. package/dist/cjs/ssr/client.d.cts +2 -0
  94. package/dist/cjs/ssr/defaultRenderHandler.cjs +15 -0
  95. package/dist/cjs/ssr/defaultRenderHandler.cjs.map +1 -0
  96. package/dist/cjs/ssr/defaultRenderHandler.d.cts +1 -0
  97. package/dist/cjs/ssr/defaultStreamHandler.cjs +16 -0
  98. package/dist/cjs/ssr/defaultStreamHandler.cjs.map +1 -0
  99. package/dist/cjs/ssr/defaultStreamHandler.d.cts +1 -0
  100. package/dist/cjs/ssr/renderRouterToStream.cjs +73 -0
  101. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -0
  102. package/dist/cjs/ssr/renderRouterToStream.d.cts +8 -0
  103. package/dist/cjs/ssr/renderRouterToString.cjs +31 -0
  104. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -0
  105. package/dist/cjs/ssr/renderRouterToString.d.cts +7 -0
  106. package/dist/cjs/ssr/serializer.d.cts +6 -0
  107. package/dist/cjs/ssr/server.cjs +20 -0
  108. package/dist/cjs/ssr/server.cjs.map +1 -0
  109. package/dist/cjs/ssr/server.d.cts +6 -0
  110. package/dist/cjs/structuralSharing.d.cts +8 -0
  111. package/dist/cjs/typePrimitives.d.cts +16 -0
  112. package/dist/cjs/useBlocker.cjs +171 -0
  113. package/dist/cjs/useBlocker.cjs.map +1 -0
  114. package/dist/cjs/useBlocker.d.cts +66 -0
  115. package/dist/cjs/useCanGoBack.cjs +8 -0
  116. package/dist/cjs/useCanGoBack.cjs.map +1 -0
  117. package/dist/cjs/useCanGoBack.d.cts +1 -0
  118. package/dist/cjs/useLoaderData.cjs +15 -0
  119. package/dist/cjs/useLoaderData.cjs.map +1 -0
  120. package/dist/cjs/useLoaderData.d.cts +19 -0
  121. package/dist/cjs/useLoaderDeps.cjs +14 -0
  122. package/dist/cjs/useLoaderDeps.cjs.map +1 -0
  123. package/dist/cjs/useLoaderDeps.d.cts +19 -0
  124. package/dist/cjs/useLocation.cjs +10 -0
  125. package/dist/cjs/useLocation.cjs.map +1 -0
  126. package/dist/cjs/useLocation.d.cts +18 -0
  127. package/dist/cjs/useMatch.cjs +47 -0
  128. package/dist/cjs/useMatch.cjs.map +1 -0
  129. package/dist/cjs/useMatch.d.cts +14 -0
  130. package/dist/cjs/useNavigate.cjs +49 -0
  131. package/dist/cjs/useNavigate.cjs.map +1 -0
  132. package/dist/cjs/useNavigate.d.cts +28 -0
  133. package/dist/cjs/useParams.cjs +17 -0
  134. package/dist/cjs/useParams.cjs.map +1 -0
  135. package/dist/cjs/useParams.d.cts +21 -0
  136. package/dist/cjs/useRouteContext.cjs +11 -0
  137. package/dist/cjs/useRouteContext.cjs.map +1 -0
  138. package/dist/cjs/useRouteContext.d.cts +3 -0
  139. package/dist/cjs/useRouter.cjs +32 -0
  140. package/dist/cjs/useRouter.cjs.map +1 -0
  141. package/dist/cjs/useRouter.d.cts +14 -0
  142. package/dist/cjs/useRouterState.cjs +38 -0
  143. package/dist/cjs/useRouterState.cjs.map +1 -0
  144. package/dist/cjs/useRouterState.d.cts +20 -0
  145. package/dist/cjs/useSearch.cjs +16 -0
  146. package/dist/cjs/useSearch.cjs.map +1 -0
  147. package/dist/cjs/useSearch.d.cts +21 -0
  148. package/dist/cjs/utils.cjs +62 -0
  149. package/dist/cjs/utils.cjs.map +1 -0
  150. package/dist/cjs/utils.d.cts +54 -0
  151. package/dist/esm/Asset.d.ts +5 -0
  152. package/dist/esm/Asset.js +160 -0
  153. package/dist/esm/Asset.js.map +1 -0
  154. package/dist/esm/CatchBoundary.d.ts +12 -0
  155. package/dist/esm/CatchBoundary.js +97 -0
  156. package/dist/esm/CatchBoundary.js.map +1 -0
  157. package/dist/esm/ClientOnly.d.ts +49 -0
  158. package/dist/esm/ClientOnly.js +21 -0
  159. package/dist/esm/ClientOnly.js.map +1 -0
  160. package/dist/esm/HeadContent.d.ts +6 -0
  161. package/dist/esm/HeadContent.dev.d.ts +10 -0
  162. package/dist/esm/HeadContent.dev.js +25 -0
  163. package/dist/esm/HeadContent.dev.js.map +1 -0
  164. package/dist/esm/HeadContent.js +15 -0
  165. package/dist/esm/HeadContent.js.map +1 -0
  166. package/dist/esm/Match.d.ts +14 -0
  167. package/dist/esm/Match.js +238 -0
  168. package/dist/esm/Match.js.map +1 -0
  169. package/dist/esm/Matches.d.ts +68 -0
  170. package/dist/esm/Matches.js +121 -0
  171. package/dist/esm/Matches.js.map +1 -0
  172. package/dist/esm/RouterProvider.d.ts +23 -0
  173. package/dist/esm/RouterProvider.js +32 -0
  174. package/dist/esm/RouterProvider.js.map +1 -0
  175. package/dist/esm/SafeFragment.d.ts +1 -0
  176. package/dist/esm/SafeFragment.js +8 -0
  177. package/dist/esm/SafeFragment.js.map +1 -0
  178. package/dist/esm/ScriptOnce.d.ts +6 -0
  179. package/dist/esm/ScriptOnce.js +22 -0
  180. package/dist/esm/ScriptOnce.js.map +1 -0
  181. package/dist/esm/Scripts.d.ts +5 -0
  182. package/dist/esm/Scripts.js +56 -0
  183. package/dist/esm/Scripts.js.map +1 -0
  184. package/dist/esm/ScrollRestoration.d.ts +14 -0
  185. package/dist/esm/ScrollRestoration.js +38 -0
  186. package/dist/esm/ScrollRestoration.js.map +1 -0
  187. package/dist/esm/Transitioner.d.ts +1 -0
  188. package/dist/esm/Transitioner.js +102 -0
  189. package/dist/esm/Transitioner.js.map +1 -0
  190. package/dist/esm/awaited.d.ts +14 -0
  191. package/dist/esm/awaited.js +34 -0
  192. package/dist/esm/awaited.js.map +1 -0
  193. package/dist/esm/fileRoute.d.ts +87 -0
  194. package/dist/esm/fileRoute.js +109 -0
  195. package/dist/esm/fileRoute.js.map +1 -0
  196. package/dist/esm/headContentUtils.d.ts +7 -0
  197. package/dist/esm/headContentUtils.js +168 -0
  198. package/dist/esm/headContentUtils.js.map +1 -0
  199. package/dist/esm/history.d.ts +8 -0
  200. package/dist/esm/index.d.ts +51 -0
  201. package/dist/esm/index.dev.d.ts +2 -0
  202. package/dist/esm/index.dev.js +133 -0
  203. package/dist/esm/index.dev.js.map +1 -0
  204. package/dist/esm/index.js +133 -0
  205. package/dist/esm/index.js.map +1 -0
  206. package/dist/esm/lazyRouteComponent.d.ts +11 -0
  207. package/dist/esm/lazyRouteComponent.js +53 -0
  208. package/dist/esm/lazyRouteComponent.js.map +1 -0
  209. package/dist/esm/link.d.ts +98 -0
  210. package/dist/esm/link.js +556 -0
  211. package/dist/esm/link.js.map +1 -0
  212. package/dist/esm/matchContext.d.ts +3 -0
  213. package/dist/esm/matchContext.js +10 -0
  214. package/dist/esm/matchContext.js.map +1 -0
  215. package/dist/esm/not-found.d.ts +9 -0
  216. package/dist/esm/not-found.js +38 -0
  217. package/dist/esm/not-found.js.map +1 -0
  218. package/dist/esm/renderRouteNotFound.d.ts +10 -0
  219. package/dist/esm/renderRouteNotFound.js +22 -0
  220. package/dist/esm/renderRouteNotFound.js.map +1 -0
  221. package/dist/esm/route.d.ts +142 -0
  222. package/dist/esm/route.js +198 -0
  223. package/dist/esm/route.js.map +1 -0
  224. package/dist/esm/router.d.ts +83 -0
  225. package/dist/esm/router.js +22 -0
  226. package/dist/esm/router.js.map +1 -0
  227. package/dist/esm/routerContext.d.ts +3 -0
  228. package/dist/esm/routerContext.js +6 -0
  229. package/dist/esm/routerContext.js.map +1 -0
  230. package/dist/esm/scroll-restoration.d.ts +1 -0
  231. package/dist/esm/scroll-restoration.js +39 -0
  232. package/dist/esm/scroll-restoration.js.map +1 -0
  233. package/dist/esm/ssr/RouterClient.d.ts +4 -0
  234. package/dist/esm/ssr/RouterClient.js +25 -0
  235. package/dist/esm/ssr/RouterClient.js.map +1 -0
  236. package/dist/esm/ssr/RouterServer.d.ts +4 -0
  237. package/dist/esm/ssr/RouterServer.js +9 -0
  238. package/dist/esm/ssr/RouterServer.js.map +1 -0
  239. package/dist/esm/ssr/client.d.ts +2 -0
  240. package/dist/esm/ssr/client.js +6 -0
  241. package/dist/esm/ssr/client.js.map +1 -0
  242. package/dist/esm/ssr/defaultRenderHandler.d.ts +1 -0
  243. package/dist/esm/ssr/defaultRenderHandler.js +15 -0
  244. package/dist/esm/ssr/defaultRenderHandler.js.map +1 -0
  245. package/dist/esm/ssr/defaultStreamHandler.d.ts +1 -0
  246. package/dist/esm/ssr/defaultStreamHandler.js +16 -0
  247. package/dist/esm/ssr/defaultStreamHandler.js.map +1 -0
  248. package/dist/esm/ssr/renderRouterToStream.d.ts +8 -0
  249. package/dist/esm/ssr/renderRouterToStream.js +73 -0
  250. package/dist/esm/ssr/renderRouterToStream.js.map +1 -0
  251. package/dist/esm/ssr/renderRouterToString.d.ts +7 -0
  252. package/dist/esm/ssr/renderRouterToString.js +31 -0
  253. package/dist/esm/ssr/renderRouterToString.js.map +1 -0
  254. package/dist/esm/ssr/serializer.d.ts +6 -0
  255. package/dist/esm/ssr/server.d.ts +6 -0
  256. package/dist/esm/ssr/server.js +14 -0
  257. package/dist/esm/ssr/server.js.map +1 -0
  258. package/dist/esm/structuralSharing.d.ts +8 -0
  259. package/dist/esm/typePrimitives.d.ts +16 -0
  260. package/dist/esm/useBlocker.d.ts +66 -0
  261. package/dist/esm/useBlocker.js +154 -0
  262. package/dist/esm/useBlocker.js.map +1 -0
  263. package/dist/esm/useCanGoBack.d.ts +1 -0
  264. package/dist/esm/useCanGoBack.js +8 -0
  265. package/dist/esm/useCanGoBack.js.map +1 -0
  266. package/dist/esm/useLoaderData.d.ts +19 -0
  267. package/dist/esm/useLoaderData.js +15 -0
  268. package/dist/esm/useLoaderData.js.map +1 -0
  269. package/dist/esm/useLoaderDeps.d.ts +19 -0
  270. package/dist/esm/useLoaderDeps.js +14 -0
  271. package/dist/esm/useLoaderDeps.js.map +1 -0
  272. package/dist/esm/useLocation.d.ts +18 -0
  273. package/dist/esm/useLocation.js +10 -0
  274. package/dist/esm/useLocation.js.map +1 -0
  275. package/dist/esm/useMatch.d.ts +14 -0
  276. package/dist/esm/useMatch.js +30 -0
  277. package/dist/esm/useMatch.js.map +1 -0
  278. package/dist/esm/useNavigate.d.ts +28 -0
  279. package/dist/esm/useNavigate.js +32 -0
  280. package/dist/esm/useNavigate.js.map +1 -0
  281. package/dist/esm/useParams.d.ts +21 -0
  282. package/dist/esm/useParams.js +17 -0
  283. package/dist/esm/useParams.js.map +1 -0
  284. package/dist/esm/useRouteContext.d.ts +3 -0
  285. package/dist/esm/useRouteContext.js +11 -0
  286. package/dist/esm/useRouteContext.js.map +1 -0
  287. package/dist/esm/useRouter.d.ts +14 -0
  288. package/dist/esm/useRouter.js +15 -0
  289. package/dist/esm/useRouter.js.map +1 -0
  290. package/dist/esm/useRouterState.d.ts +20 -0
  291. package/dist/esm/useRouterState.js +38 -0
  292. package/dist/esm/useRouterState.js.map +1 -0
  293. package/dist/esm/useSearch.d.ts +21 -0
  294. package/dist/esm/useSearch.js +16 -0
  295. package/dist/esm/useSearch.js.map +1 -0
  296. package/dist/esm/utils.d.ts +54 -0
  297. package/dist/esm/utils.js +45 -0
  298. package/dist/esm/utils.js.map +1 -0
  299. package/dist/llms/index.d.ts +3 -0
  300. package/dist/llms/index.js +43 -0
  301. package/dist/llms/rules/api.d.ts +2 -0
  302. package/dist/llms/rules/api.js +4612 -0
  303. package/dist/llms/rules/guide.d.ts +2 -0
  304. package/dist/llms/rules/guide.js +10690 -0
  305. package/dist/llms/rules/installation.d.ts +2 -0
  306. package/dist/llms/rules/installation.js +1285 -0
  307. package/dist/llms/rules/routing.d.ts +2 -0
  308. package/dist/llms/rules/routing.js +1984 -0
  309. package/dist/llms/rules/setup-and-architecture.d.ts +2 -0
  310. package/dist/llms/rules/setup-and-architecture.js +920 -0
  311. package/package.json +142 -0
  312. package/src/Asset.tsx +219 -0
  313. package/src/CatchBoundary.tsx +120 -0
  314. package/src/ClientOnly.tsx +68 -0
  315. package/src/HeadContent.dev.tsx +46 -0
  316. package/src/HeadContent.tsx +22 -0
  317. package/src/Match.tsx +360 -0
  318. package/src/Matches.tsx +313 -0
  319. package/src/RouterProvider.tsx +92 -0
  320. package/src/SafeFragment.tsx +5 -0
  321. package/src/ScriptOnce.tsx +21 -0
  322. package/src/Scripts.tsx +80 -0
  323. package/src/ScrollRestoration.tsx +69 -0
  324. package/src/Transitioner.tsx +134 -0
  325. package/src/awaited.tsx +55 -0
  326. package/src/fileRoute.ts +313 -0
  327. package/src/headContentUtils.tsx +217 -0
  328. package/src/history.ts +9 -0
  329. package/src/index.dev.tsx +6 -0
  330. package/src/index.tsx +341 -0
  331. package/src/lazyRouteComponent.tsx +96 -0
  332. package/src/link.tsx +984 -0
  333. package/src/matchContext.tsx +8 -0
  334. package/src/not-found.tsx +43 -0
  335. package/src/renderRouteNotFound.tsx +35 -0
  336. package/src/route.tsx +740 -0
  337. package/src/router.ts +127 -0
  338. package/src/routerContext.tsx +4 -0
  339. package/src/scroll-restoration.tsx +45 -0
  340. package/src/ssr/RouterClient.tsx +22 -0
  341. package/src/ssr/RouterServer.tsx +9 -0
  342. package/src/ssr/client.ts +2 -0
  343. package/src/ssr/defaultRenderHandler.tsx +12 -0
  344. package/src/ssr/defaultStreamHandler.tsx +13 -0
  345. package/src/ssr/renderRouterToStream.tsx +90 -0
  346. package/src/ssr/renderRouterToString.tsx +36 -0
  347. package/src/ssr/serializer.ts +7 -0
  348. package/src/ssr/server.ts +6 -0
  349. package/src/structuralSharing.ts +47 -0
  350. package/src/typePrimitives.ts +84 -0
  351. package/src/useBlocker.tsx +320 -0
  352. package/src/useCanGoBack.ts +5 -0
  353. package/src/useLoaderData.tsx +91 -0
  354. package/src/useLoaderDeps.tsx +69 -0
  355. package/src/useLocation.tsx +52 -0
  356. package/src/useMatch.tsx +123 -0
  357. package/src/useNavigate.tsx +78 -0
  358. package/src/useParams.tsx +107 -0
  359. package/src/useRouteContext.ts +30 -0
  360. package/src/useRouter.tsx +25 -0
  361. package/src/useRouterState.tsx +86 -0
  362. package/src/useSearch.tsx +105 -0
  363. package/src/utils.ts +125 -0
package/src/Match.tsx ADDED
@@ -0,0 +1,360 @@
1
+ import * as React from 'react'
2
+ import invariant from 'tiny-invariant'
3
+ import warning from 'tiny-warning'
4
+ import {
5
+ createControlledPromise,
6
+ getLocationChangeInfo,
7
+ isNotFound,
8
+ isRedirect,
9
+ rootRouteId,
10
+ } from '@tanstack/router-core'
11
+ import { isServer } from '@tanstack/router-core/isServer'
12
+ import { CatchBoundary, ErrorComponent } from './CatchBoundary'
13
+ import { useRouterState } from './useRouterState'
14
+ import { useRouter } from './useRouter'
15
+ import { CatchNotFound } from './not-found'
16
+ import { matchContext } from './matchContext'
17
+ import { SafeFragment } from './SafeFragment'
18
+ import { renderRouteNotFound } from './renderRouteNotFound'
19
+ import { ScrollRestoration } from './scroll-restoration'
20
+ import { ClientOnly } from './ClientOnly'
21
+ import type {
22
+ AnyRoute,
23
+ ParsedLocation,
24
+ RootRouteOptions,
25
+ } from '@tanstack/router-core'
26
+
27
+ export const Match = React.memo(function MatchImpl({
28
+ matchId,
29
+ }: {
30
+ matchId: string
31
+ }) {
32
+ const router = useRouter()
33
+ const matchState = useRouterState({
34
+ select: (s) => {
35
+ const matchIndex = s.matches.findIndex((d) => d.id === matchId)
36
+ const match = s.matches[matchIndex]
37
+ invariant(
38
+ match,
39
+ `Could not find match for matchId "${matchId}". Please file an issue!`,
40
+ )
41
+ return {
42
+ routeId: match.routeId,
43
+ ssr: match.ssr,
44
+ _displayPending: match._displayPending,
45
+ resetKey: s.loadedAt,
46
+ parentRouteId: s.matches[matchIndex - 1]?.routeId as string,
47
+ }
48
+ },
49
+ structuralSharing: true as any,
50
+ })
51
+
52
+ const route: AnyRoute = router.routesById[matchState.routeId]
53
+
54
+ const PendingComponent =
55
+ route.options.pendingComponent ?? router.options.defaultPendingComponent
56
+
57
+ const pendingElement = PendingComponent ? <PendingComponent /> : null
58
+
59
+ const routeErrorComponent =
60
+ route.options.errorComponent ?? router.options.defaultErrorComponent
61
+
62
+ const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch
63
+
64
+ const routeNotFoundComponent = route.isRoot
65
+ ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
66
+ (route.options.notFoundComponent ??
67
+ router.options.notFoundRoute?.options.component)
68
+ : route.options.notFoundComponent
69
+
70
+ const resolvedNoSsr =
71
+ matchState.ssr === false || matchState.ssr === 'data-only'
72
+ const ResolvedSuspenseBoundary =
73
+ // If we're on the root route, allow forcefully wrapping in suspense
74
+ (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) &&
75
+ (route.options.wrapInSuspense ??
76
+ PendingComponent ??
77
+ ((route.options.errorComponent as any)?.preload || resolvedNoSsr))
78
+ ? React.Suspense
79
+ : SafeFragment
80
+
81
+ const ResolvedCatchBoundary = routeErrorComponent
82
+ ? CatchBoundary
83
+ : SafeFragment
84
+
85
+ const ResolvedNotFoundBoundary = routeNotFoundComponent
86
+ ? CatchNotFound
87
+ : SafeFragment
88
+
89
+ const ShellComponent = route.isRoot
90
+ ? ((route.options as RootRouteOptions).shellComponent ?? SafeFragment)
91
+ : SafeFragment
92
+ return (
93
+ <ShellComponent>
94
+ <matchContext.Provider value={matchId}>
95
+ <ResolvedSuspenseBoundary fallback={pendingElement}>
96
+ <ResolvedCatchBoundary
97
+ getResetKey={() => matchState.resetKey}
98
+ errorComponent={routeErrorComponent || ErrorComponent}
99
+ onCatch={(error, errorInfo) => {
100
+ // Forward not found errors (we don't want to show the error component for these)
101
+ if (isNotFound(error)) throw error
102
+ warning(false, `Error in route match: ${matchId}`)
103
+ routeOnCatch?.(error, errorInfo)
104
+ }}
105
+ >
106
+ <ResolvedNotFoundBoundary
107
+ fallback={(error) => {
108
+ // If the current not found handler doesn't exist or it has a
109
+ // route ID which doesn't match the current route, rethrow the error
110
+ if (
111
+ !routeNotFoundComponent ||
112
+ (error.routeId && error.routeId !== matchState.routeId) ||
113
+ (!error.routeId && !route.isRoot)
114
+ )
115
+ throw error
116
+
117
+ return React.createElement(routeNotFoundComponent, error as any)
118
+ }}
119
+ >
120
+ {resolvedNoSsr || matchState._displayPending ? (
121
+ <ClientOnly fallback={pendingElement}>
122
+ <MatchInner matchId={matchId} />
123
+ </ClientOnly>
124
+ ) : (
125
+ <MatchInner matchId={matchId} />
126
+ )}
127
+ </ResolvedNotFoundBoundary>
128
+ </ResolvedCatchBoundary>
129
+ </ResolvedSuspenseBoundary>
130
+ </matchContext.Provider>
131
+ {matchState.parentRouteId === rootRouteId &&
132
+ router.options.scrollRestoration ? (
133
+ <>
134
+ <OnRendered />
135
+ <ScrollRestoration />
136
+ </>
137
+ ) : null}
138
+ </ShellComponent>
139
+ )
140
+ })
141
+
142
+ // On Rendered can't happen above the root layout because it actually
143
+ // renders a dummy dom element to track the rendered state of the app.
144
+ // We render a script tag with a key that changes based on the current
145
+ // location state.__TSR_key. Also, because it's below the root layout, it
146
+ // allows us to fire onRendered events even after a hydration mismatch
147
+ // error that occurred above the root layout (like bad head/link tags,
148
+ // which is common).
149
+ function OnRendered() {
150
+ const router = useRouter()
151
+
152
+ const prevLocationRef = React.useRef<undefined | ParsedLocation<{}>>(
153
+ undefined,
154
+ )
155
+
156
+ return (
157
+ <script
158
+ key={router.latestLocation.state.__TSR_key}
159
+ suppressHydrationWarning
160
+ ref={(el) => {
161
+ if (
162
+ el &&
163
+ (prevLocationRef.current === undefined ||
164
+ prevLocationRef.current.href !== router.latestLocation.href)
165
+ ) {
166
+ router.emit({
167
+ type: 'onRendered',
168
+ ...getLocationChangeInfo(router.state),
169
+ })
170
+ prevLocationRef.current = router.latestLocation
171
+ }
172
+ }}
173
+ />
174
+ )
175
+ }
176
+
177
+ export const MatchInner = React.memo(function MatchInnerImpl({
178
+ matchId,
179
+ }: {
180
+ matchId: string
181
+ }): any {
182
+ const router = useRouter()
183
+
184
+ const { match, key, routeId } = useRouterState({
185
+ select: (s) => {
186
+ const match = s.matches.find((d) => d.id === matchId)!
187
+ const routeId = match.routeId as string
188
+
189
+ const remountFn =
190
+ (router.routesById[routeId] as AnyRoute).options.remountDeps ??
191
+ router.options.defaultRemountDeps
192
+ const remountDeps = remountFn?.({
193
+ routeId,
194
+ loaderDeps: match.loaderDeps,
195
+ params: match._strictParams,
196
+ search: match._strictSearch,
197
+ })
198
+ const key = remountDeps ? JSON.stringify(remountDeps) : undefined
199
+
200
+ return {
201
+ key,
202
+ routeId,
203
+ match: {
204
+ id: match.id,
205
+ status: match.status,
206
+ error: match.error,
207
+ invalid: match.invalid,
208
+ _forcePending: match._forcePending,
209
+ _displayPending: match._displayPending,
210
+ },
211
+ }
212
+ },
213
+ structuralSharing: true as any,
214
+ })
215
+
216
+ const route = router.routesById[routeId] as AnyRoute
217
+
218
+ const out = React.useMemo(() => {
219
+ const Comp = route.options.component ?? router.options.defaultComponent
220
+ if (Comp) {
221
+ return <Comp key={key} />
222
+ }
223
+ return <Outlet />
224
+ }, [key, route.options.component, router.options.defaultComponent])
225
+
226
+ if (match._displayPending) {
227
+ throw router.getMatch(match.id)?._nonReactive.displayPendingPromise
228
+ }
229
+
230
+ if (match._forcePending) {
231
+ throw router.getMatch(match.id)?._nonReactive.minPendingPromise
232
+ }
233
+
234
+ // see also hydrate() in packages/router-core/src/ssr/ssr-client.ts
235
+ if (match.status === 'pending') {
236
+ // We're pending, and if we have a minPendingMs, we need to wait for it
237
+ const pendingMinMs =
238
+ route.options.pendingMinMs ?? router.options.defaultPendingMinMs
239
+ if (pendingMinMs) {
240
+ const routerMatch = router.getMatch(match.id)
241
+ if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
242
+ // Create a promise that will resolve after the minPendingMs
243
+ if (!(isServer ?? router.isServer)) {
244
+ const minPendingPromise = createControlledPromise<void>()
245
+
246
+ routerMatch._nonReactive.minPendingPromise = minPendingPromise
247
+
248
+ setTimeout(() => {
249
+ minPendingPromise.resolve()
250
+ // We've handled the minPendingPromise, so we can delete it
251
+ routerMatch._nonReactive.minPendingPromise = undefined
252
+ }, pendingMinMs)
253
+ }
254
+ }
255
+ }
256
+ throw router.getMatch(match.id)?._nonReactive.loadPromise
257
+ }
258
+
259
+ if (match.status === 'notFound') {
260
+ invariant(isNotFound(match.error), 'Expected a notFound error')
261
+ return renderRouteNotFound(router, route, match.error)
262
+ }
263
+
264
+ if (match.status === 'redirected') {
265
+ // Redirects should be handled by the router transition. If we happen to
266
+ // encounter a redirect here, it's a bug. Let's warn, but render nothing.
267
+ invariant(isRedirect(match.error), 'Expected a redirect error')
268
+
269
+ // warning(
270
+ // false,
271
+ // 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!',
272
+ // )
273
+ throw router.getMatch(match.id)?._nonReactive.loadPromise
274
+ }
275
+
276
+ if (match.status === 'error') {
277
+ // If we're on the server, we need to use React's new and super
278
+ // wonky api for throwing errors from a server side render inside
279
+ // of a suspense boundary. This is the only way to get
280
+ // renderToPipeableStream to not hang indefinitely.
281
+ // We'll serialize the error and rethrow it on the client.
282
+ if (isServer ?? router.isServer) {
283
+ const RouteErrorComponent =
284
+ (route.options.errorComponent ??
285
+ router.options.defaultErrorComponent) ||
286
+ ErrorComponent
287
+ return (
288
+ <RouteErrorComponent
289
+ error={match.error as any}
290
+ reset={undefined as any}
291
+ info={{
292
+ componentStack: '',
293
+ }}
294
+ />
295
+ )
296
+ }
297
+
298
+ throw match.error
299
+ }
300
+
301
+ return out
302
+ })
303
+
304
+ /**
305
+ * Render the next child match in the route tree. Typically used inside
306
+ * a route component to render nested routes.
307
+ *
308
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
309
+ */
310
+ export const Outlet = React.memo(function OutletImpl() {
311
+ const router = useRouter()
312
+ const matchId = React.useContext(matchContext)
313
+ const routeId = useRouterState({
314
+ select: (s) => s.matches.find((d) => d.id === matchId)?.routeId as string,
315
+ })
316
+
317
+ const route = router.routesById[routeId]!
318
+
319
+ const parentGlobalNotFound = useRouterState({
320
+ select: (s) => {
321
+ const matches = s.matches
322
+ const parentMatch = matches.find((d) => d.id === matchId)
323
+ invariant(
324
+ parentMatch,
325
+ `Could not find parent match for matchId "${matchId}"`,
326
+ )
327
+ return parentMatch.globalNotFound
328
+ },
329
+ })
330
+
331
+ const childMatchId = useRouterState({
332
+ select: (s) => {
333
+ const matches = s.matches
334
+ const index = matches.findIndex((d) => d.id === matchId)
335
+ return matches[index + 1]?.id
336
+ },
337
+ })
338
+
339
+ const pendingElement = router.options.defaultPendingComponent ? (
340
+ <router.options.defaultPendingComponent />
341
+ ) : null
342
+
343
+ if (parentGlobalNotFound) {
344
+ return renderRouteNotFound(router, route, undefined)
345
+ }
346
+
347
+ if (!childMatchId) {
348
+ return null
349
+ }
350
+
351
+ const nextMatch = <Match matchId={childMatchId} />
352
+
353
+ if (routeId === rootRouteId) {
354
+ return (
355
+ <React.Suspense fallback={pendingElement}>{nextMatch}</React.Suspense>
356
+ )
357
+ }
358
+
359
+ return nextMatch
360
+ })
@@ -0,0 +1,313 @@
1
+ import * as React from 'react'
2
+ import warning from 'tiny-warning'
3
+ import { rootRouteId } from '@tanstack/router-core'
4
+ import { isServer } from '@tanstack/router-core/isServer'
5
+ import { CatchBoundary, ErrorComponent } from './CatchBoundary'
6
+ import { useRouterState } from './useRouterState'
7
+ import { useRouter } from './useRouter'
8
+ import { Transitioner } from './Transitioner'
9
+ import { matchContext } from './matchContext'
10
+ import { Match } from './Match'
11
+ import { SafeFragment } from './SafeFragment'
12
+ import type {
13
+ StructuralSharingOption,
14
+ ValidateSelected,
15
+ } from './structuralSharing'
16
+ import type {
17
+ AnyRoute,
18
+ AnyRouter,
19
+ DeepPartial,
20
+ Expand,
21
+ MakeOptionalPathParams,
22
+ MakeOptionalSearchParams,
23
+ MakeRouteMatchUnion,
24
+ MaskOptions,
25
+ MatchRouteOptions,
26
+ NoInfer,
27
+ RegisteredRouter,
28
+ ResolveRelativePath,
29
+ ResolveRoute,
30
+ RouteByPath,
31
+ RouterState,
32
+ ToSubOptionsProps,
33
+ } from '@tanstack/router-core'
34
+
35
+ declare module '@tanstack/router-core' {
36
+ export interface RouteMatchExtensions {
37
+ meta?: Array<React.JSX.IntrinsicElements['meta'] | undefined>
38
+ links?: Array<React.JSX.IntrinsicElements['link'] | undefined>
39
+ scripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>
40
+ styles?: Array<React.JSX.IntrinsicElements['style'] | undefined>
41
+ headScripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Internal component that renders the router's active match tree with
47
+ * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.
48
+ */
49
+ export function Matches() {
50
+ const router = useRouter()
51
+ const rootRoute: AnyRoute = router.routesById[rootRouteId]
52
+
53
+ const PendingComponent =
54
+ rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent
55
+
56
+ const pendingElement = PendingComponent ? <PendingComponent /> : null
57
+
58
+ // Do not render a root Suspense during SSR or hydrating from SSR
59
+ const ResolvedSuspense =
60
+ (isServer ?? router.isServer) ||
61
+ (typeof document !== 'undefined' && router.ssr)
62
+ ? SafeFragment
63
+ : React.Suspense
64
+
65
+ const inner = (
66
+ <ResolvedSuspense fallback={pendingElement}>
67
+ {!(isServer ?? router.isServer) && <Transitioner />}
68
+ <MatchesInner />
69
+ </ResolvedSuspense>
70
+ )
71
+
72
+ return router.options.InnerWrap ? (
73
+ <router.options.InnerWrap>{inner}</router.options.InnerWrap>
74
+ ) : (
75
+ inner
76
+ )
77
+ }
78
+
79
+ function MatchesInner() {
80
+ const router = useRouter()
81
+ const matchId = useRouterState({
82
+ select: (s) => {
83
+ return s.matches[0]?.id
84
+ },
85
+ })
86
+
87
+ const resetKey = useRouterState({
88
+ select: (s) => s.loadedAt,
89
+ })
90
+
91
+ const matchComponent = matchId ? <Match matchId={matchId} /> : null
92
+
93
+ return (
94
+ <matchContext.Provider value={matchId}>
95
+ {router.options.disableGlobalCatchBoundary ? (
96
+ matchComponent
97
+ ) : (
98
+ <CatchBoundary
99
+ getResetKey={() => resetKey}
100
+ errorComponent={ErrorComponent}
101
+ onCatch={
102
+ process.env.NODE_ENV !== 'production'
103
+ ? (error) => {
104
+ warning(
105
+ false,
106
+ `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,
107
+ )
108
+ warning(false, error.message || error.toString())
109
+ }
110
+ : undefined
111
+ }
112
+ >
113
+ {matchComponent}
114
+ </CatchBoundary>
115
+ )}
116
+ </matchContext.Provider>
117
+ )
118
+ }
119
+
120
+ export type UseMatchRouteOptions<
121
+ TRouter extends AnyRouter = RegisteredRouter,
122
+ TFrom extends string = string,
123
+ TTo extends string | undefined = undefined,
124
+ TMaskFrom extends string = TFrom,
125
+ TMaskTo extends string = '',
126
+ > = ToSubOptionsProps<TRouter, TFrom, TTo> &
127
+ DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &
128
+ DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &
129
+ MaskOptions<TRouter, TMaskFrom, TMaskTo> &
130
+ MatchRouteOptions
131
+
132
+ /**
133
+ * Create a matcher function for testing locations against route definitions.
134
+ *
135
+ * The returned function accepts standard navigation options (`to`, `params`,
136
+ * `search`, etc.) and returns either `false` (no match) or the matched params
137
+ * object when the route matches the current or pending location.
138
+ *
139
+ * Useful for conditional rendering and active UI states.
140
+ *
141
+ * @returns A `matchRoute(options)` function that returns `false` or params.
142
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchRouteHook
143
+ */
144
+ export function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {
145
+ const router = useRouter()
146
+
147
+ useRouterState({
148
+ select: (s) => [s.location.href, s.resolvedLocation?.href, s.status],
149
+ structuralSharing: true as any,
150
+ })
151
+
152
+ return React.useCallback(
153
+ <
154
+ const TFrom extends string = string,
155
+ const TTo extends string | undefined = undefined,
156
+ const TMaskFrom extends string = TFrom,
157
+ const TMaskTo extends string = '',
158
+ >(
159
+ opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,
160
+ ):
161
+ | false
162
+ | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']> => {
163
+ const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts
164
+
165
+ return router.matchRoute(rest as any, {
166
+ pending,
167
+ caseSensitive,
168
+ fuzzy,
169
+ includeSearch,
170
+ })
171
+ },
172
+ [router],
173
+ )
174
+ }
175
+
176
+ export type MakeMatchRouteOptions<
177
+ TRouter extends AnyRouter = RegisteredRouter,
178
+ TFrom extends string = string,
179
+ TTo extends string | undefined = undefined,
180
+ TMaskFrom extends string = TFrom,
181
+ TMaskTo extends string = '',
182
+ > = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
183
+ // 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
184
+ children?:
185
+ | ((
186
+ params?: RouteByPath<
187
+ TRouter['routeTree'],
188
+ ResolveRelativePath<TFrom, NoInfer<TTo>>
189
+ >['types']['allParams'],
190
+ ) => React.ReactNode)
191
+ | React.ReactNode
192
+ }
193
+
194
+ /**
195
+ * Component that conditionally renders its children based on whether a route
196
+ * matches the provided `from`/`to` options. If `children` is a function, it
197
+ * receives the matched params object.
198
+ *
199
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/matchRouteComponent
200
+ */
201
+ export function MatchRoute<
202
+ TRouter extends AnyRouter = RegisteredRouter,
203
+ const TFrom extends string = string,
204
+ const TTo extends string | undefined = undefined,
205
+ const TMaskFrom extends string = TFrom,
206
+ const TMaskTo extends string = '',
207
+ >(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {
208
+ const matchRoute = useMatchRoute()
209
+ const params = matchRoute(props as any) as boolean
210
+
211
+ if (typeof props.children === 'function') {
212
+ return (props.children as any)(params)
213
+ }
214
+
215
+ return params ? props.children : null
216
+ }
217
+
218
+ export interface UseMatchesBaseOptions<
219
+ TRouter extends AnyRouter,
220
+ TSelected,
221
+ TStructuralSharing,
222
+ > {
223
+ select?: (
224
+ matches: Array<MakeRouteMatchUnion<TRouter>>,
225
+ ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>
226
+ }
227
+
228
+ export type UseMatchesResult<
229
+ TRouter extends AnyRouter,
230
+ TSelected,
231
+ > = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected
232
+
233
+ export function useMatches<
234
+ TRouter extends AnyRouter = RegisteredRouter,
235
+ TSelected = unknown,
236
+ TStructuralSharing extends boolean = boolean,
237
+ >(
238
+ opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &
239
+ StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,
240
+ ): UseMatchesResult<TRouter, TSelected> {
241
+ return useRouterState({
242
+ select: (state: RouterState<TRouter['routeTree']>) => {
243
+ const matches = state.matches
244
+ return opts?.select
245
+ ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)
246
+ : matches
247
+ },
248
+ structuralSharing: opts?.structuralSharing,
249
+ } as any) as UseMatchesResult<TRouter, TSelected>
250
+ }
251
+
252
+ /**
253
+ * Read the full array of active route matches or select a derived subset.
254
+ *
255
+ * Useful for debugging, breadcrumbs, or aggregating metadata across matches.
256
+ *
257
+ * @returns The array of matches (or the selected value).
258
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook
259
+ */
260
+
261
+ /**
262
+ * Read the full array of active route matches or select a derived subset.
263
+ *
264
+ * Useful for debugging, breadcrumbs, or aggregating metadata across matches.
265
+ *
266
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook
267
+ */
268
+ export function useParentMatches<
269
+ TRouter extends AnyRouter = RegisteredRouter,
270
+ TSelected = unknown,
271
+ TStructuralSharing extends boolean = boolean,
272
+ >(
273
+ opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &
274
+ StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,
275
+ ): UseMatchesResult<TRouter, TSelected> {
276
+ const contextMatchId = React.useContext(matchContext)
277
+
278
+ return useMatches({
279
+ select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {
280
+ matches = matches.slice(
281
+ 0,
282
+ matches.findIndex((d) => d.id === contextMatchId),
283
+ )
284
+ return opts?.select ? opts.select(matches) : matches
285
+ },
286
+ structuralSharing: opts?.structuralSharing,
287
+ } as any)
288
+ }
289
+
290
+ /**
291
+ * Read the array of active route matches that are children of the current
292
+ * match (or selected parent) in the match tree.
293
+ */
294
+ export function useChildMatches<
295
+ TRouter extends AnyRouter = RegisteredRouter,
296
+ TSelected = unknown,
297
+ TStructuralSharing extends boolean = boolean,
298
+ >(
299
+ opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &
300
+ StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,
301
+ ): UseMatchesResult<TRouter, TSelected> {
302
+ const contextMatchId = React.useContext(matchContext)
303
+
304
+ return useMatches({
305
+ select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {
306
+ matches = matches.slice(
307
+ matches.findIndex((d) => d.id === contextMatchId) + 1,
308
+ )
309
+ return opts?.select ? opts.select(matches) : matches
310
+ },
311
+ structuralSharing: opts?.structuralSharing,
312
+ } as any)
313
+ }