@depup/tanstack__react-router 1.167.0-depup.0 → 1.167.3-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 (197) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/Asset.cjs +115 -174
  3. package/dist/cjs/Asset.cjs.map +1 -1
  4. package/dist/cjs/CatchBoundary.cjs +92 -108
  5. package/dist/cjs/CatchBoundary.cjs.map +1 -1
  6. package/dist/cjs/ClientOnly.cjs +47 -13
  7. package/dist/cjs/ClientOnly.cjs.map +1 -1
  8. package/dist/cjs/HeadContent.cjs +23 -12
  9. package/dist/cjs/HeadContent.cjs.map +1 -1
  10. package/dist/cjs/HeadContent.dev.cjs +33 -38
  11. package/dist/cjs/HeadContent.dev.cjs.map +1 -1
  12. package/dist/cjs/Match.cjs +190 -247
  13. package/dist/cjs/Match.cjs.map +1 -1
  14. package/dist/cjs/Matches.cjs +131 -118
  15. package/dist/cjs/Matches.cjs.map +1 -1
  16. package/dist/cjs/RouterProvider.cjs +43 -27
  17. package/dist/cjs/RouterProvider.cjs.map +1 -1
  18. package/dist/cjs/SafeFragment.cjs +9 -5
  19. package/dist/cjs/SafeFragment.cjs.map +1 -1
  20. package/dist/cjs/ScriptOnce.cjs +17 -19
  21. package/dist/cjs/ScriptOnce.cjs.map +1 -1
  22. package/dist/cjs/Scripts.cjs +56 -54
  23. package/dist/cjs/Scripts.cjs.map +1 -1
  24. package/dist/cjs/ScrollRestoration.cjs +26 -30
  25. package/dist/cjs/ScrollRestoration.cjs.map +1 -1
  26. package/dist/cjs/Transitioner.cjs +109 -116
  27. package/dist/cjs/Transitioner.cjs.map +1 -1
  28. package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
  29. package/dist/cjs/awaited.cjs +28 -43
  30. package/dist/cjs/awaited.cjs.map +1 -1
  31. package/dist/cjs/fileRoute.cjs +133 -95
  32. package/dist/cjs/fileRoute.cjs.map +1 -1
  33. package/dist/cjs/headContentUtils.cjs +144 -181
  34. package/dist/cjs/headContentUtils.cjs.map +1 -1
  35. package/dist/cjs/index.cjs +249 -178
  36. package/dist/cjs/index.dev.cjs +249 -178
  37. package/dist/cjs/lazyRouteComponent.cjs +52 -67
  38. package/dist/cjs/lazyRouteComponent.cjs.map +1 -1
  39. package/dist/cjs/link.cjs +462 -556
  40. package/dist/cjs/link.cjs.map +1 -1
  41. package/dist/cjs/matchContext.cjs +9 -25
  42. package/dist/cjs/matchContext.cjs.map +1 -1
  43. package/dist/cjs/not-found.cjs +25 -32
  44. package/dist/cjs/not-found.cjs.map +1 -1
  45. package/dist/cjs/renderRouteNotFound.cjs +25 -19
  46. package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
  47. package/dist/cjs/route.cjs +258 -178
  48. package/dist/cjs/route.cjs.map +1 -1
  49. package/dist/cjs/router.cjs +29 -16
  50. package/dist/cjs/router.cjs.map +1 -1
  51. package/dist/cjs/routerContext.cjs +8 -22
  52. package/dist/cjs/routerContext.cjs.map +1 -1
  53. package/dist/cjs/scroll-restoration.cjs +23 -36
  54. package/dist/cjs/scroll-restoration.cjs.map +1 -1
  55. package/dist/cjs/ssr/RouterClient.cjs +16 -22
  56. package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
  57. package/dist/cjs/ssr/RouterServer.cjs +10 -6
  58. package/dist/cjs/ssr/RouterServer.cjs.map +1 -1
  59. package/dist/cjs/ssr/client.cjs +10 -10
  60. package/dist/cjs/ssr/defaultRenderHandler.cjs +13 -14
  61. package/dist/cjs/ssr/defaultRenderHandler.cjs.map +1 -1
  62. package/dist/cjs/ssr/defaultStreamHandler.cjs +14 -15
  63. package/dist/cjs/ssr/defaultStreamHandler.cjs.map +1 -1
  64. package/dist/cjs/ssr/renderRouterToStream.cjs +51 -71
  65. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
  66. package/dist/cjs/ssr/renderRouterToString.cjs +26 -29
  67. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
  68. package/dist/cjs/ssr/server.cjs +18 -18
  69. package/dist/cjs/useBlocker.cjs +126 -162
  70. package/dist/cjs/useBlocker.cjs.map +1 -1
  71. package/dist/cjs/useCanGoBack.cjs +6 -5
  72. package/dist/cjs/useCanGoBack.cjs.map +1 -1
  73. package/dist/cjs/useLoaderData.cjs +24 -12
  74. package/dist/cjs/useLoaderData.cjs.map +1 -1
  75. package/dist/cjs/useLoaderDeps.cjs +23 -11
  76. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  77. package/dist/cjs/useLocation.cjs +17 -7
  78. package/dist/cjs/useLocation.cjs.map +1 -1
  79. package/dist/cjs/useMatch.cjs +25 -44
  80. package/dist/cjs/useMatch.cjs.map +1 -1
  81. package/dist/cjs/useNavigate.cjs +53 -43
  82. package/dist/cjs/useNavigate.cjs.map +1 -1
  83. package/dist/cjs/useParams.cjs +27 -14
  84. package/dist/cjs/useParams.cjs.map +1 -1
  85. package/dist/cjs/useRouteContext.cjs +9 -8
  86. package/dist/cjs/useRouteContext.cjs.map +1 -1
  87. package/dist/cjs/useRouter.cjs +23 -29
  88. package/dist/cjs/useRouter.cjs.map +1 -1
  89. package/dist/cjs/useRouterState.cjs +40 -35
  90. package/dist/cjs/useRouterState.cjs.map +1 -1
  91. package/dist/cjs/useSearch.cjs +26 -13
  92. package/dist/cjs/useSearch.cjs.map +1 -1
  93. package/dist/cjs/utils.cjs +81 -51
  94. package/dist/cjs/utils.cjs.map +1 -1
  95. package/dist/esm/Asset.js +112 -156
  96. package/dist/esm/Asset.js.map +1 -1
  97. package/dist/esm/CatchBoundary.js +90 -92
  98. package/dist/esm/CatchBoundary.js.map +1 -1
  99. package/dist/esm/ClientOnly.js +45 -14
  100. package/dist/esm/ClientOnly.js.map +1 -1
  101. package/dist/esm/HeadContent.dev.js +31 -21
  102. package/dist/esm/HeadContent.dev.js.map +1 -1
  103. package/dist/esm/HeadContent.js +20 -11
  104. package/dist/esm/HeadContent.js.map +1 -1
  105. package/dist/esm/Match.js +181 -226
  106. package/dist/esm/Match.js.map +1 -1
  107. package/dist/esm/Matches.js +125 -103
  108. package/dist/esm/Matches.js.map +1 -1
  109. package/dist/esm/RouterProvider.js +41 -28
  110. package/dist/esm/RouterProvider.js.map +1 -1
  111. package/dist/esm/SafeFragment.js +8 -6
  112. package/dist/esm/SafeFragment.js.map +1 -1
  113. package/dist/esm/ScriptOnce.js +15 -18
  114. package/dist/esm/ScriptOnce.js.map +1 -1
  115. package/dist/esm/Scripts.js +55 -54
  116. package/dist/esm/Scripts.js.map +1 -1
  117. package/dist/esm/ScrollRestoration.js +25 -31
  118. package/dist/esm/ScrollRestoration.js.map +1 -1
  119. package/dist/esm/Transitioner.js +106 -98
  120. package/dist/esm/Transitioner.js.map +1 -1
  121. package/dist/esm/awaited.js +26 -27
  122. package/dist/esm/awaited.js.map +1 -1
  123. package/dist/esm/fileRoute.js +127 -96
  124. package/dist/esm/fileRoute.js.map +1 -1
  125. package/dist/esm/headContentUtils.js +141 -163
  126. package/dist/esm/headContentUtils.js.map +1 -1
  127. package/dist/esm/index.dev.js +16 -117
  128. package/dist/esm/index.js +18 -118
  129. package/dist/esm/lazyRouteComponent.js +50 -50
  130. package/dist/esm/lazyRouteComponent.js.map +1 -1
  131. package/dist/esm/link.js +459 -541
  132. package/dist/esm/link.js.map +1 -1
  133. package/dist/esm/matchContext.js +8 -10
  134. package/dist/esm/matchContext.js.map +1 -1
  135. package/dist/esm/not-found.js +22 -32
  136. package/dist/esm/not-found.js.map +1 -1
  137. package/dist/esm/renderRouteNotFound.js +21 -18
  138. package/dist/esm/renderRouteNotFound.js.map +1 -1
  139. package/dist/esm/route.js +249 -180
  140. package/dist/esm/route.js.map +1 -1
  141. package/dist/esm/router.js +28 -17
  142. package/dist/esm/router.js.map +1 -1
  143. package/dist/esm/routerContext.js +7 -6
  144. package/dist/esm/routerContext.js.map +1 -1
  145. package/dist/esm/scroll-restoration.js +21 -35
  146. package/dist/esm/scroll-restoration.js.map +1 -1
  147. package/dist/esm/ssr/RouterClient.js +14 -21
  148. package/dist/esm/ssr/RouterClient.js.map +1 -1
  149. package/dist/esm/ssr/RouterServer.js +8 -6
  150. package/dist/esm/ssr/RouterServer.js.map +1 -1
  151. package/dist/esm/ssr/client.js +1 -4
  152. package/dist/esm/ssr/defaultRenderHandler.js +12 -13
  153. package/dist/esm/ssr/defaultRenderHandler.js.map +1 -1
  154. package/dist/esm/ssr/defaultStreamHandler.js +13 -14
  155. package/dist/esm/ssr/defaultStreamHandler.js.map +1 -1
  156. package/dist/esm/ssr/renderRouterToStream.js +48 -70
  157. package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
  158. package/dist/esm/ssr/renderRouterToString.js +24 -29
  159. package/dist/esm/ssr/renderRouterToString.js.map +1 -1
  160. package/dist/esm/ssr/server.js +3 -10
  161. package/dist/esm/useBlocker.js +124 -146
  162. package/dist/esm/useBlocker.js.map +1 -1
  163. package/dist/esm/useCanGoBack.js +6 -5
  164. package/dist/esm/useCanGoBack.js.map +1 -1
  165. package/dist/esm/useLoaderData.js +24 -12
  166. package/dist/esm/useLoaderData.js.map +1 -1
  167. package/dist/esm/useLoaderDeps.js +23 -11
  168. package/dist/esm/useLoaderDeps.js.map +1 -1
  169. package/dist/esm/useLocation.js +17 -7
  170. package/dist/esm/useLocation.js.map +1 -1
  171. package/dist/esm/useMatch.js +21 -26
  172. package/dist/esm/useMatch.js.map +1 -1
  173. package/dist/esm/useNavigate.js +50 -26
  174. package/dist/esm/useNavigate.js.map +1 -1
  175. package/dist/esm/useParams.js +27 -14
  176. package/dist/esm/useParams.js.map +1 -1
  177. package/dist/esm/useRouteContext.js +9 -8
  178. package/dist/esm/useRouteContext.js.map +1 -1
  179. package/dist/esm/useRouter.js +20 -12
  180. package/dist/esm/useRouter.js.map +1 -1
  181. package/dist/esm/useRouterState.js +38 -34
  182. package/dist/esm/useRouterState.js.map +1 -1
  183. package/dist/esm/useSearch.js +26 -13
  184. package/dist/esm/useSearch.js.map +1 -1
  185. package/dist/esm/utils.js +80 -39
  186. package/dist/esm/utils.js.map +1 -1
  187. package/dist/llms/rules/guide.d.ts +1 -1
  188. package/dist/llms/rules/guide.js +2 -2
  189. package/package.json +5 -5
  190. package/dist/cjs/index.cjs.map +0 -1
  191. package/dist/cjs/index.dev.cjs.map +0 -1
  192. package/dist/cjs/ssr/client.cjs.map +0 -1
  193. package/dist/cjs/ssr/server.cjs.map +0 -1
  194. package/dist/esm/index.dev.js.map +0 -1
  195. package/dist/esm/index.js.map +0 -1
  196. package/dist/esm/ssr/client.js.map +0 -1
  197. package/dist/esm/ssr/server.js.map +0 -1
@@ -1,21 +1,52 @@
1
+ import React from "react";
1
2
  import { jsx } from "react/jsx-runtime";
2
- import React__default from "react";
3
+ //#region src/ClientOnly.tsx
4
+ /**
5
+ * Render the children only after the JS has loaded client-side. Use an optional
6
+ * fallback component if the JS is not yet loaded.
7
+ *
8
+ * @example
9
+ * Render a Chart component if JS loads, renders a simple FakeChart
10
+ * component server-side or if there is no JS. The FakeChart can have only the
11
+ * UI without the behavior or be a loading spinner or skeleton.
12
+ *
13
+ * ```tsx
14
+ * return (
15
+ * <ClientOnly fallback={<FakeChart />}>
16
+ * <Chart />
17
+ * </ClientOnly>
18
+ * )
19
+ * ```
20
+ */
3
21
  function ClientOnly({ children, fallback = null }) {
4
- return useHydrated() ? /* @__PURE__ */ jsx(React__default.Fragment, { children }) : /* @__PURE__ */ jsx(React__default.Fragment, { children: fallback });
22
+ return useHydrated() ? /* @__PURE__ */ jsx(React.Fragment, { children }) : /* @__PURE__ */ jsx(React.Fragment, { children: fallback });
5
23
  }
24
+ /**
25
+ * Return a boolean indicating if the JS has been hydrated already.
26
+ * When doing Server-Side Rendering, the result will always be false.
27
+ * When doing Client-Side Rendering, the result will always be false on the
28
+ * first render and true from then on. Even if a new component renders it will
29
+ * always start with true.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * // Disable a button that needs JS to work.
34
+ * let hydrated = useHydrated()
35
+ * return (
36
+ * <button type="button" disabled={!hydrated} onClick={doSomethingCustom}>
37
+ * Click me
38
+ * </button>
39
+ * )
40
+ * ```
41
+ * @returns True if the JS has been hydrated already, false otherwise.
42
+ */
6
43
  function useHydrated() {
7
- return React__default.useSyncExternalStore(
8
- subscribe,
9
- () => true,
10
- () => false
11
- );
44
+ return React.useSyncExternalStore(subscribe, () => true, () => false);
12
45
  }
13
46
  function subscribe() {
14
- return () => {
15
- };
47
+ return () => {};
16
48
  }
17
- export {
18
- ClientOnly,
19
- useHydrated
20
- };
21
- //# sourceMappingURL=ClientOnly.js.map
49
+ //#endregion
50
+ export { ClientOnly, useHydrated };
51
+
52
+ //# sourceMappingURL=ClientOnly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientOnly.js","sources":["../../src/ClientOnly.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ClientOnlyProps {\n /**\n * The children to render when the JS is loaded.\n */\n children: React.ReactNode\n /**\n * The fallback component to render if the JS is not yet loaded.\n */\n fallback?: React.ReactNode\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * <Chart />\n * </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n return useHydrated() ? (\n <React.Fragment>{children}</React.Fragment>\n ) : (\n <React.Fragment>{fallback}</React.Fragment>\n )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * let hydrated = useHydrated()\n * return (\n * <button type=\"button\" disabled={!hydrated} onClick={doSomethingCustom}>\n * Click me\n * </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nfunction subscribe() {\n return () => {}\n}\n"],"names":["React"],"mappings":";;AA8BO,SAAS,WAAW,EAAE,UAAU,WAAW,QAAyB;AACzE,SAAO,YAAA,IACL,oBAACA,eAAM,UAAN,EAAgB,SAAA,CAAS,IAE1B,oBAACA,eAAM,UAAN,EAAgB,UAAA,SAAA,CAAS;AAE9B;AAqBO,SAAS,cAAuB;AACrC,SAAOA,eAAM;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EAAA;AAEV;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;"}
1
+ {"version":3,"file":"ClientOnly.js","names":[],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ClientOnlyProps {\n /**\n * The children to render when the JS is loaded.\n */\n children: React.ReactNode\n /**\n * The fallback component to render if the JS is not yet loaded.\n */\n fallback?: React.ReactNode\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * <Chart />\n * </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n return useHydrated() ? (\n <React.Fragment>{children}</React.Fragment>\n ) : (\n <React.Fragment>{fallback}</React.Fragment>\n )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * let hydrated = useHydrated()\n * return (\n * <button type=\"button\" disabled={!hydrated} onClick={doSomethingCustom}>\n * Click me\n * </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nfunction subscribe() {\n return () => {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,WAAW,EAAE,UAAU,WAAW,QAAyB;AACzE,QAAO,aAAa,GAClB,oBAAC,MAAM,UAAP,EAAiB,UAA0B,CAAA,GAE3C,oBAAC,MAAM,UAAP,EAAA,UAAiB,UAA0B,CAAA;;;;;;;;;;;;;;;;;;;;;AAuB/C,SAAgB,cAAuB;AACrC,QAAO,MAAM,qBACX,iBACM,YACA,MACP;;AAGH,SAAS,YAAY;AACnB,cAAa"}
@@ -1,25 +1,35 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import { createElement } from "react";
4
- import { Asset } from "./Asset.js";
5
- import { useRouter } from "./useRouter.js";
6
1
  import { useHydrated } from "./ClientOnly.js";
2
+ import { useRouter } from "./useRouter.js";
3
+ import { Asset } from "./Asset.js";
7
4
  import { useTags } from "./headContentUtils.js";
8
- const DEV_STYLES_ATTR = "data-tanstack-router-dev-styles";
5
+ import * as React$1 from "react";
6
+ import { createElement } from "react";
7
+ import { Fragment, jsx } from "react/jsx-runtime";
8
+ //#region src/HeadContent.dev.tsx
9
+ var DEV_STYLES_ATTR = "data-tanstack-router-dev-styles";
10
+ /**
11
+ * Render route-managed head tags (title, meta, links, styles, head scripts).
12
+ * Place inside the document head of your app shell.
13
+ *
14
+ * Development version: filters out dev styles link after hydration and
15
+ * includes a fallback cleanup effect for hydration mismatch cases.
16
+ *
17
+ * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management
18
+ */
9
19
  function HeadContent() {
10
- const tags = useTags();
11
- const router = useRouter();
12
- const nonce = router.options.ssr?.nonce;
13
- const hydrated = useHydrated();
14
- React.useEffect(() => {
15
- if (hydrated) {
16
- document.querySelectorAll(`link[${DEV_STYLES_ATTR}]`).forEach((el) => el.remove());
17
- }
18
- }, [hydrated]);
19
- const filteredTags = hydrated ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR]) : tags;
20
- return /* @__PURE__ */ jsx(Fragment, { children: filteredTags.map((tag) => /* @__PURE__ */ createElement(Asset, { ...tag, key: `tsr-meta-${JSON.stringify(tag)}`, nonce })) });
20
+ const tags = useTags();
21
+ const nonce = useRouter().options.ssr?.nonce;
22
+ const hydrated = useHydrated();
23
+ React$1.useEffect(() => {
24
+ if (hydrated) document.querySelectorAll(`link[${DEV_STYLES_ATTR}]`).forEach((el) => el.remove());
25
+ }, [hydrated]);
26
+ return /* @__PURE__ */ jsx(Fragment, { children: (hydrated ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR]) : tags).map((tag) => /* @__PURE__ */ createElement(Asset, {
27
+ ...tag,
28
+ key: `tsr-meta-${JSON.stringify(tag)}`,
29
+ nonce
30
+ })) });
21
31
  }
22
- export {
23
- HeadContent
24
- };
25
- //# sourceMappingURL=HeadContent.dev.js.map
32
+ //#endregion
33
+ export { HeadContent };
34
+
35
+ //# sourceMappingURL=HeadContent.dev.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeadContent.dev.js","sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent() {\n const tags = useTags()\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const hydrated = useHydrated()\n\n // Fallback cleanup for hydration mismatch cases\n // Runs when hydration completes to remove any orphaned dev styles links from DOM\n React.useEffect(() => {\n if (hydrated) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\n }, [hydrated])\n\n // Filter out dev styles after hydration\n const filteredTags = hydrated\n ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n : tags\n\n return (\n <>\n {filteredTags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,kBAAkB;AAWjB,SAAS,cAAc;AAC5B,QAAM,OAAO,QAAA;AACb,QAAM,SAAS,UAAA;AACf,QAAM,QAAQ,OAAO,QAAQ,KAAK;AAClC,QAAM,WAAW,YAAA;AAIjB,QAAM,UAAU,MAAM;AACpB,QAAI,UAAU;AACZ,eACG,iBAAiB,QAAQ,eAAe,GAAG,EAC3C,QAAQ,CAAC,OAAO,GAAG,OAAA,CAAQ;AAAA,IAChC;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAGb,QAAM,eAAe,WACjB,KAAK,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,eAAe,CAAC,IAClD;AAEJ,yCAEK,UAAA,aAAa,IAAI,CAAC,QACjB,8BAAC,SAAO,GAAG,KAAK,KAAK,YAAY,KAAK,UAAU,GAAG,CAAC,IAAI,OAAc,CACvE,GACH;AAEJ;"}
1
+ {"version":3,"file":"HeadContent.dev.js","names":[],"sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent() {\n const tags = useTags()\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const hydrated = useHydrated()\n\n // Fallback cleanup for hydration mismatch cases\n // Runs when hydration completes to remove any orphaned dev styles links from DOM\n React.useEffect(() => {\n if (hydrated) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\n }, [hydrated])\n\n // Filter out dev styles after hydration\n const filteredTags = hydrated\n ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n : tags\n\n return (\n <>\n {filteredTags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;;;;AAMA,IAAM,kBAAkB;;;;;;;;;;AAWxB,SAAgB,cAAc;CAC5B,MAAM,OAAO,SAAS;CAEtB,MAAM,QADS,WAAW,CACL,QAAQ,KAAK;CAClC,MAAM,WAAW,aAAa;AAI9B,SAAM,gBAAgB;AACpB,MAAI,SACF,UACG,iBAAiB,QAAQ,gBAAgB,GAAG,CAC5C,SAAS,OAAO,GAAG,QAAQ,CAAC;IAEhC,CAAC,SAAS,CAAC;AAOd,QACE,oBAAA,UAAA,EAAA,WALmB,WACjB,KAAK,QAAQ,QAAQ,CAAC,IAAI,QAAQ,iBAAiB,GACnD,MAIc,KAAK,QACjB,8BAAC,OAAD;EAAO,GAAI;EAAK,KAAK,YAAY,KAAK,UAAU,IAAI;EAAW;EAAS,CAAA,CACxE,EACD,CAAA"}
@@ -1,15 +1,24 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { createElement } from "react";
3
- import { Asset } from "./Asset.js";
4
1
  import { useRouter } from "./useRouter.js";
2
+ import { Asset } from "./Asset.js";
5
3
  import { useTags } from "./headContentUtils.js";
4
+ import { createElement } from "react";
5
+ import { Fragment, jsx } from "react/jsx-runtime";
6
+ //#region src/HeadContent.tsx
7
+ /**
8
+ * Render route-managed head tags (title, meta, links, styles, head scripts).
9
+ * Place inside the document head of your app shell.
10
+ * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management
11
+ */
6
12
  function HeadContent() {
7
- const tags = useTags();
8
- const router = useRouter();
9
- const nonce = router.options.ssr?.nonce;
10
- return /* @__PURE__ */ jsx(Fragment, { children: tags.map((tag) => /* @__PURE__ */ createElement(Asset, { ...tag, key: `tsr-meta-${JSON.stringify(tag)}`, nonce })) });
13
+ const tags = useTags();
14
+ const nonce = useRouter().options.ssr?.nonce;
15
+ return /* @__PURE__ */ jsx(Fragment, { children: tags.map((tag) => /* @__PURE__ */ createElement(Asset, {
16
+ ...tag,
17
+ key: `tsr-meta-${JSON.stringify(tag)}`,
18
+ nonce
19
+ })) });
11
20
  }
12
- export {
13
- HeadContent
14
- };
15
- //# sourceMappingURL=HeadContent.js.map
21
+ //#endregion
22
+ export { HeadContent };
23
+
24
+ //# sourceMappingURL=HeadContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeadContent.js","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent() {\n const tags = useTags()\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n return (\n <>\n {tags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"names":[],"mappings":";;;;;AAUO,SAAS,cAAc;AAC5B,QAAM,OAAO,QAAA;AACb,QAAM,SAAS,UAAA;AACf,QAAM,QAAQ,OAAO,QAAQ,KAAK;AAClC,yCAEK,UAAA,KAAK,IAAI,CAAC,QACT,8BAAC,SAAO,GAAG,KAAK,KAAK,YAAY,KAAK,UAAU,GAAG,CAAC,IAAI,OAAc,CACvE,GACH;AAEJ;"}
1
+ {"version":3,"file":"HeadContent.js","names":[],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent() {\n const tags = useTags()\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n return (\n <>\n {tags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,cAAc;CAC5B,MAAM,OAAO,SAAS;CAEtB,MAAM,QADS,WAAW,CACL,QAAQ,KAAK;AAClC,QACE,oBAAA,UAAA,EAAA,UACG,KAAK,KAAK,QACT,8BAAC,OAAD;EAAO,GAAI;EAAK,KAAK,YAAY,KAAK,UAAU,IAAI;EAAW;EAAS,CAAA,CACxE,EACD,CAAA"}
package/dist/esm/Match.js CHANGED
@@ -1,237 +1,192 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import invariant from "tiny-invariant";
4
- import warning from "tiny-warning";
5
- import { isNotFound, rootRouteId, createControlledPromise, isRedirect, getLocationChangeInfo } from "@tanstack/router-core";
6
- import { isServer } from "@tanstack/router-core/isServer";
7
1
  import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
8
- import { useRouterState } from "./useRouterState.js";
2
+ import { ClientOnly } from "./ClientOnly.js";
9
3
  import { useRouter } from "./useRouter.js";
10
- import { CatchNotFound } from "./not-found.js";
4
+ import { useRouterState } from "./useRouterState.js";
11
5
  import { matchContext } from "./matchContext.js";
6
+ import { CatchNotFound } from "./not-found.js";
12
7
  import { SafeFragment } from "./SafeFragment.js";
13
8
  import { renderRouteNotFound } from "./renderRouteNotFound.js";
14
9
  import { ScrollRestoration } from "./scroll-restoration.js";
15
- import { ClientOnly } from "./ClientOnly.js";
16
- const Match = React.memo(function MatchImpl({
17
- matchId
18
- }) {
19
- const router = useRouter();
20
- const matchState = useRouterState({
21
- select: (s) => {
22
- const matchIndex = s.matches.findIndex((d) => d.id === matchId);
23
- const match = s.matches[matchIndex];
24
- invariant(
25
- match,
26
- `Could not find match for matchId "${matchId}". Please file an issue!`
27
- );
28
- return {
29
- routeId: match.routeId,
30
- ssr: match.ssr,
31
- _displayPending: match._displayPending,
32
- resetKey: s.loadedAt,
33
- parentRouteId: s.matches[matchIndex - 1]?.routeId
34
- };
35
- },
36
- structuralSharing: true
37
- });
38
- const route = router.routesById[matchState.routeId];
39
- const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
40
- const pendingElement = PendingComponent ? /* @__PURE__ */ jsx(PendingComponent, {}) : null;
41
- const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
42
- const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
43
- const routeNotFoundComponent = route.isRoot ? (
44
- // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
45
- route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component
46
- ) : route.options.notFoundComponent;
47
- const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
48
- const ResolvedSuspenseBoundary = (
49
- // If we're on the root route, allow forcefully wrapping in suspense
50
- (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? React.Suspense : SafeFragment
51
- );
52
- const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
53
- const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
54
- const ShellComponent = route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment;
55
- return /* @__PURE__ */ jsxs(ShellComponent, { children: [
56
- /* @__PURE__ */ jsx(matchContext.Provider, { value: matchId, children: /* @__PURE__ */ jsx(ResolvedSuspenseBoundary, { fallback: pendingElement, children: /* @__PURE__ */ jsx(
57
- ResolvedCatchBoundary,
58
- {
59
- getResetKey: () => matchState.resetKey,
60
- errorComponent: routeErrorComponent || ErrorComponent,
61
- onCatch: (error, errorInfo) => {
62
- if (isNotFound(error)) throw error;
63
- warning(false, `Error in route match: ${matchId}`);
64
- routeOnCatch?.(error, errorInfo);
65
- },
66
- children: /* @__PURE__ */ jsx(
67
- ResolvedNotFoundBoundary,
68
- {
69
- fallback: (error) => {
70
- if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot)
71
- throw error;
72
- return React.createElement(routeNotFoundComponent, error);
73
- },
74
- children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ jsx(ClientOnly, { fallback: pendingElement, children: /* @__PURE__ */ jsx(MatchInner, { matchId }) }) : /* @__PURE__ */ jsx(MatchInner, { matchId })
75
- }
76
- )
77
- }
78
- ) }) }),
79
- matchState.parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ jsxs(Fragment, { children: [
80
- /* @__PURE__ */ jsx(OnRendered, {}),
81
- /* @__PURE__ */ jsx(ScrollRestoration, {})
82
- ] }) : null
83
- ] });
10
+ import { createControlledPromise, getLocationChangeInfo, isNotFound, isRedirect, rootRouteId } from "@tanstack/router-core";
11
+ import * as React$1 from "react";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ import warning from "tiny-warning";
14
+ import invariant from "tiny-invariant";
15
+ import { isServer } from "@tanstack/router-core/isServer";
16
+ //#region src/Match.tsx
17
+ var Match = React$1.memo(function MatchImpl({ matchId }) {
18
+ const router = useRouter();
19
+ const matchState = useRouterState({
20
+ select: (s) => {
21
+ const matchIndex = s.matches.findIndex((d) => d.id === matchId);
22
+ const match = s.matches[matchIndex];
23
+ invariant(match, `Could not find match for matchId "${matchId}". Please file an issue!`);
24
+ return {
25
+ routeId: match.routeId,
26
+ ssr: match.ssr,
27
+ _displayPending: match._displayPending,
28
+ resetKey: s.loadedAt,
29
+ parentRouteId: s.matches[matchIndex - 1]?.routeId
30
+ };
31
+ },
32
+ structuralSharing: true
33
+ });
34
+ const route = router.routesById[matchState.routeId];
35
+ const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
36
+ const pendingElement = PendingComponent ? /* @__PURE__ */ jsx(PendingComponent, {}) : null;
37
+ const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
38
+ const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
39
+ const routeNotFoundComponent = route.isRoot ? route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component : route.options.notFoundComponent;
40
+ const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
41
+ const ResolvedSuspenseBoundary = (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? React$1.Suspense : SafeFragment;
42
+ const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
43
+ const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
44
+ return /* @__PURE__ */ jsxs(route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment, { children: [/* @__PURE__ */ jsx(matchContext.Provider, {
45
+ value: matchId,
46
+ children: /* @__PURE__ */ jsx(ResolvedSuspenseBoundary, {
47
+ fallback: pendingElement,
48
+ children: /* @__PURE__ */ jsx(ResolvedCatchBoundary, {
49
+ getResetKey: () => matchState.resetKey,
50
+ errorComponent: routeErrorComponent || ErrorComponent,
51
+ onCatch: (error, errorInfo) => {
52
+ if (isNotFound(error)) throw error;
53
+ warning(false, `Error in route match: ${matchId}`);
54
+ routeOnCatch?.(error, errorInfo);
55
+ },
56
+ children: /* @__PURE__ */ jsx(ResolvedNotFoundBoundary, {
57
+ fallback: (error) => {
58
+ if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot) throw error;
59
+ return React$1.createElement(routeNotFoundComponent, error);
60
+ },
61
+ children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ jsx(ClientOnly, {
62
+ fallback: pendingElement,
63
+ children: /* @__PURE__ */ jsx(MatchInner, { matchId })
64
+ }) : /* @__PURE__ */ jsx(MatchInner, { matchId })
65
+ })
66
+ })
67
+ })
68
+ }), matchState.parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(OnRendered, {}), /* @__PURE__ */ jsx(ScrollRestoration, {})] }) : null] });
84
69
  });
85
70
  function OnRendered() {
86
- const router = useRouter();
87
- const prevLocationRef = React.useRef(
88
- void 0
89
- );
90
- return /* @__PURE__ */ jsx(
91
- "script",
92
- {
93
- suppressHydrationWarning: true,
94
- ref: (el) => {
95
- if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
96
- router.emit({
97
- type: "onRendered",
98
- ...getLocationChangeInfo(router.state)
99
- });
100
- prevLocationRef.current = router.latestLocation;
101
- }
102
- }
103
- },
104
- router.latestLocation.state.__TSR_key
105
- );
71
+ const router = useRouter();
72
+ const prevLocationRef = React$1.useRef(void 0);
73
+ return /* @__PURE__ */ jsx("script", {
74
+ suppressHydrationWarning: true,
75
+ ref: (el) => {
76
+ if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
77
+ router.emit({
78
+ type: "onRendered",
79
+ ...getLocationChangeInfo(router.state)
80
+ });
81
+ prevLocationRef.current = router.latestLocation;
82
+ }
83
+ }
84
+ }, router.latestLocation.state.__TSR_key);
106
85
  }
107
- const MatchInner = React.memo(function MatchInnerImpl({
108
- matchId
109
- }) {
110
- const router = useRouter();
111
- const { match, key, routeId } = useRouterState({
112
- select: (s) => {
113
- const match2 = s.matches.find((d) => d.id === matchId);
114
- const routeId2 = match2.routeId;
115
- const remountFn = router.routesById[routeId2].options.remountDeps ?? router.options.defaultRemountDeps;
116
- const remountDeps = remountFn?.({
117
- routeId: routeId2,
118
- loaderDeps: match2.loaderDeps,
119
- params: match2._strictParams,
120
- search: match2._strictSearch
121
- });
122
- const key2 = remountDeps ? JSON.stringify(remountDeps) : void 0;
123
- return {
124
- key: key2,
125
- routeId: routeId2,
126
- match: {
127
- id: match2.id,
128
- status: match2.status,
129
- error: match2.error,
130
- _forcePending: match2._forcePending,
131
- _displayPending: match2._displayPending
132
- }
133
- };
134
- },
135
- structuralSharing: true
136
- });
137
- const route = router.routesById[routeId];
138
- const out = React.useMemo(() => {
139
- const Comp = route.options.component ?? router.options.defaultComponent;
140
- if (Comp) {
141
- return /* @__PURE__ */ jsx(Comp, {}, key);
142
- }
143
- return /* @__PURE__ */ jsx(Outlet, {});
144
- }, [key, route.options.component, router.options.defaultComponent]);
145
- if (match._displayPending) {
146
- throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
147
- }
148
- if (match._forcePending) {
149
- throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
150
- }
151
- if (match.status === "pending") {
152
- const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
153
- if (pendingMinMs) {
154
- const routerMatch = router.getMatch(match.id);
155
- if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
156
- if (!(isServer ?? router.isServer)) {
157
- const minPendingPromise = createControlledPromise();
158
- routerMatch._nonReactive.minPendingPromise = minPendingPromise;
159
- setTimeout(() => {
160
- minPendingPromise.resolve();
161
- routerMatch._nonReactive.minPendingPromise = void 0;
162
- }, pendingMinMs);
163
- }
164
- }
165
- }
166
- throw router.getMatch(match.id)?._nonReactive.loadPromise;
167
- }
168
- if (match.status === "notFound") {
169
- invariant(isNotFound(match.error), "Expected a notFound error");
170
- return renderRouteNotFound(router, route, match.error);
171
- }
172
- if (match.status === "redirected") {
173
- invariant(isRedirect(match.error), "Expected a redirect error");
174
- throw router.getMatch(match.id)?._nonReactive.loadPromise;
175
- }
176
- if (match.status === "error") {
177
- if (isServer ?? router.isServer) {
178
- const RouteErrorComponent = (route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent;
179
- return /* @__PURE__ */ jsx(
180
- RouteErrorComponent,
181
- {
182
- error: match.error,
183
- reset: void 0,
184
- info: {
185
- componentStack: ""
186
- }
187
- }
188
- );
189
- }
190
- throw match.error;
191
- }
192
- return out;
86
+ var MatchInner = React$1.memo(function MatchInnerImpl({ matchId }) {
87
+ const router = useRouter();
88
+ const { match, key, routeId } = useRouterState({
89
+ select: (s) => {
90
+ const match = s.matches.find((d) => d.id === matchId);
91
+ const routeId = match.routeId;
92
+ const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
93
+ routeId,
94
+ loaderDeps: match.loaderDeps,
95
+ params: match._strictParams,
96
+ search: match._strictSearch
97
+ });
98
+ return {
99
+ key: remountDeps ? JSON.stringify(remountDeps) : void 0,
100
+ routeId,
101
+ match: {
102
+ id: match.id,
103
+ status: match.status,
104
+ error: match.error,
105
+ _forcePending: match._forcePending,
106
+ _displayPending: match._displayPending
107
+ }
108
+ };
109
+ },
110
+ structuralSharing: true
111
+ });
112
+ const route = router.routesById[routeId];
113
+ const out = React$1.useMemo(() => {
114
+ const Comp = route.options.component ?? router.options.defaultComponent;
115
+ if (Comp) return /* @__PURE__ */ jsx(Comp, {}, key);
116
+ return /* @__PURE__ */ jsx(Outlet, {});
117
+ }, [
118
+ key,
119
+ route.options.component,
120
+ router.options.defaultComponent
121
+ ]);
122
+ if (match._displayPending) throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
123
+ if (match._forcePending) throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
124
+ if (match.status === "pending") {
125
+ const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
126
+ if (pendingMinMs) {
127
+ const routerMatch = router.getMatch(match.id);
128
+ if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
129
+ if (!(isServer ?? router.isServer)) {
130
+ const minPendingPromise = createControlledPromise();
131
+ routerMatch._nonReactive.minPendingPromise = minPendingPromise;
132
+ setTimeout(() => {
133
+ minPendingPromise.resolve();
134
+ routerMatch._nonReactive.minPendingPromise = void 0;
135
+ }, pendingMinMs);
136
+ }
137
+ }
138
+ }
139
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
140
+ }
141
+ if (match.status === "notFound") {
142
+ invariant(isNotFound(match.error), "Expected a notFound error");
143
+ return renderRouteNotFound(router, route, match.error);
144
+ }
145
+ if (match.status === "redirected") {
146
+ invariant(isRedirect(match.error), "Expected a redirect error");
147
+ throw router.getMatch(match.id)?._nonReactive.loadPromise;
148
+ }
149
+ if (match.status === "error") {
150
+ if (isServer ?? router.isServer) return /* @__PURE__ */ jsx((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
151
+ error: match.error,
152
+ reset: void 0,
153
+ info: { componentStack: "" }
154
+ });
155
+ throw match.error;
156
+ }
157
+ return out;
193
158
  });
194
- const Outlet = React.memo(function OutletImpl() {
195
- const router = useRouter();
196
- const matchId = React.useContext(matchContext);
197
- const routeId = useRouterState({
198
- select: (s) => s.matches.find((d) => d.id === matchId)?.routeId
199
- });
200
- const route = router.routesById[routeId];
201
- const parentGlobalNotFound = useRouterState({
202
- select: (s) => {
203
- const matches = s.matches;
204
- const parentMatch = matches.find((d) => d.id === matchId);
205
- invariant(
206
- parentMatch,
207
- `Could not find parent match for matchId "${matchId}"`
208
- );
209
- return parentMatch.globalNotFound;
210
- }
211
- });
212
- const childMatchId = useRouterState({
213
- select: (s) => {
214
- const matches = s.matches;
215
- const index = matches.findIndex((d) => d.id === matchId);
216
- return matches[index + 1]?.id;
217
- }
218
- });
219
- const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ jsx(router.options.defaultPendingComponent, {}) : null;
220
- if (parentGlobalNotFound) {
221
- return renderRouteNotFound(router, route, void 0);
222
- }
223
- if (!childMatchId) {
224
- return null;
225
- }
226
- const nextMatch = /* @__PURE__ */ jsx(Match, { matchId: childMatchId });
227
- if (routeId === rootRouteId) {
228
- return /* @__PURE__ */ jsx(React.Suspense, { fallback: pendingElement, children: nextMatch });
229
- }
230
- return nextMatch;
159
+ /**
160
+ * Render the next child match in the route tree. Typically used inside
161
+ * a route component to render nested routes.
162
+ *
163
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
164
+ */
165
+ var Outlet = React$1.memo(function OutletImpl() {
166
+ const router = useRouter();
167
+ const matchId = React$1.useContext(matchContext);
168
+ const routeId = useRouterState({ select: (s) => s.matches.find((d) => d.id === matchId)?.routeId });
169
+ const route = router.routesById[routeId];
170
+ const parentGlobalNotFound = useRouterState({ select: (s) => {
171
+ const parentMatch = s.matches.find((d) => d.id === matchId);
172
+ invariant(parentMatch, `Could not find parent match for matchId "${matchId}"`);
173
+ return parentMatch.globalNotFound;
174
+ } });
175
+ const childMatchId = useRouterState({ select: (s) => {
176
+ const matches = s.matches;
177
+ return matches[matches.findIndex((d) => d.id === matchId) + 1]?.id;
178
+ } });
179
+ const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ jsx(router.options.defaultPendingComponent, {}) : null;
180
+ if (parentGlobalNotFound) return renderRouteNotFound(router, route, void 0);
181
+ if (!childMatchId) return null;
182
+ const nextMatch = /* @__PURE__ */ jsx(Match, { matchId: childMatchId });
183
+ if (routeId === rootRouteId) return /* @__PURE__ */ jsx(React$1.Suspense, {
184
+ fallback: pendingElement,
185
+ children: nextMatch
186
+ });
187
+ return nextMatch;
231
188
  });
232
- export {
233
- Match,
234
- MatchInner,
235
- Outlet
236
- };
237
- //# sourceMappingURL=Match.js.map
189
+ //#endregion
190
+ export { Match, Outlet };
191
+
192
+ //# sourceMappingURL=Match.js.map