@timber-js/app 0.2.0-alpha.239 → 0.2.0-alpha.240

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 (332) hide show
  1. package/dist/_chunks/{actions-Top9GftB.js → actions-DIgnvDrG.js} +4 -4
  2. package/dist/_chunks/{actions-Top9GftB.js.map → actions-DIgnvDrG.js.map} +1 -1
  3. package/dist/_chunks/{als-registry-DpygwCp0.js → als-registry-PPYstxK0.js} +2 -1
  4. package/dist/_chunks/{als-registry-DpygwCp0.js.map → als-registry-PPYstxK0.js.map} +1 -1
  5. package/dist/_chunks/{cache-api-Bo8c7XVF.js → cache-api-uWQwuxWb.js} +5 -5
  6. package/dist/_chunks/{cache-api-Bo8c7XVF.js.map → cache-api-uWQwuxWb.js.map} +1 -1
  7. package/dist/_chunks/{chains-DMoHX4yH.js → chains-C7CExrUI.js} +2 -2
  8. package/dist/_chunks/{chains-DMoHX4yH.js.map → chains-C7CExrUI.js.map} +1 -1
  9. package/dist/_chunks/chains-CSslTUdI.js +1 -0
  10. package/dist/_chunks/{classify-BwyAd-dZ.js → classify-Cj9EeZoL.js} +2 -2
  11. package/dist/_chunks/{classify-BwyAd-dZ.js.map → classify-Cj9EeZoL.js.map} +1 -1
  12. package/dist/_chunks/{cli-check-DQAD9MLo.js → cli-check-C3QOAru7.js} +3 -3
  13. package/dist/_chunks/{cli-check-DQAD9MLo.js.map → cli-check-C3QOAru7.js.map} +1 -1
  14. package/dist/_chunks/{cli-schema-sync-C_xNLqBj.js → cli-schema-sync-BRxZz66D.js} +1 -1
  15. package/dist/_chunks/{cli-schema-sync-CmGls3dc.js → cli-schema-sync-DQUS_o3V.js} +2 -2
  16. package/dist/_chunks/{cli-schema-sync-CmGls3dc.js.map → cli-schema-sync-DQUS_o3V.js.map} +1 -1
  17. package/dist/_chunks/{client-dep-entries-C5BTQtFS.js → client-dep-entries-ZETBdLgv.js} +2 -2
  18. package/dist/_chunks/{client-dep-entries-C5BTQtFS.js.map → client-dep-entries-ZETBdLgv.js.map} +1 -1
  19. package/dist/_chunks/{convention-lint-GQA6WTRo.js → convention-lint-BoVISNS6.js} +3 -3
  20. package/dist/_chunks/{convention-lint-GQA6WTRo.js.map → convention-lint-BoVISNS6.js.map} +1 -1
  21. package/dist/_chunks/dev-server-B8roKA3Q.js +1 -0
  22. package/dist/_chunks/{dev-server-Cr3_Fu5A.js → dev-server-C5R6jx8Q.js} +2 -2
  23. package/dist/_chunks/{dev-server-Cr3_Fu5A.js.map → dev-server-C5R6jx8Q.js.map} +1 -1
  24. package/dist/_chunks/{dev-span-RsVeYYc_.js → dev-span-0aG7Q_Ph.js} +3 -7
  25. package/dist/_chunks/dev-span-0aG7Q_Ph.js.map +1 -0
  26. package/dist/_chunks/{error-boundary-Bh-egWUI.js → error-boundary-DB51f9ih.js} +98 -419
  27. package/dist/_chunks/error-boundary-DB51f9ih.js.map +1 -0
  28. package/dist/_chunks/{flight-source-node-BsrlUjMO.js → flight-source-node-D9cHBhjP.js} +7 -4
  29. package/dist/_chunks/flight-source-node-D9cHBhjP.js.map +1 -0
  30. package/dist/_chunks/{json-lossy-check-D47R9Fp5.js → json-lossy-check-Y1GxqVX_.js} +2 -2
  31. package/dist/_chunks/{json-lossy-check-D47R9Fp5.js.map → json-lossy-check-Y1GxqVX_.js.map} +1 -1
  32. package/dist/_chunks/{live-graph-HcLScfiV.js → live-graph-BDQWvnMm.js} +4 -4
  33. package/dist/_chunks/{live-graph-HcLScfiV.js.map → live-graph-BDQWvnMm.js.map} +1 -1
  34. package/dist/_chunks/{logger-DDLtp5e-.js → logger-DmRR9tmZ.js} +2 -2
  35. package/dist/_chunks/{logger-DDLtp5e-.js.map → logger-DmRR9tmZ.js.map} +1 -1
  36. package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
  37. package/dist/_chunks/{node-response-omewa8e6.js → node-response-yp8zdyRp.js} +2 -2
  38. package/dist/_chunks/{node-response-omewa8e6.js.map → node-response-yp8zdyRp.js.map} +1 -1
  39. package/dist/_chunks/plugin-context-BtaQcMuh.js.map +1 -1
  40. package/dist/_chunks/{poison-scan-DONdiCGX.js → poison-scan-WQgUydF_.js} +2 -2
  41. package/dist/_chunks/{poison-scan-DONdiCGX.js.map → poison-scan-WQgUydF_.js.map} +1 -1
  42. package/dist/_chunks/{scanner-DSAJjH0x.js → scanner-C9Lrf77z.js} +3 -2
  43. package/dist/_chunks/{scanner-DSAJjH0x.js.map → scanner-C9Lrf77z.js.map} +1 -1
  44. package/dist/_chunks/{sizeof-DVhEVN_y.js → sizeof-BISkSaU0.js} +2 -2
  45. package/dist/_chunks/{sizeof-DVhEVN_y.js.map → sizeof-BISkSaU0.js.map} +1 -1
  46. package/dist/_chunks/{walkers-96YopJds.js → walkers-Bxv4v7tX.js} +3 -3
  47. package/dist/_chunks/{walkers-96YopJds.js.map → walkers-Bxv4v7tX.js.map} +1 -1
  48. package/dist/adapters/cloudflare-kv-cache.js +1 -1
  49. package/dist/analyze/crawl-entry.js +3 -3
  50. package/dist/analyze/graph-command.js +2 -2
  51. package/dist/cache/index.js +2 -2
  52. package/dist/cache/stores/memory.js +1 -1
  53. package/dist/cdn/workers-cache-purge.js +1 -1
  54. package/dist/cli.js +3 -3
  55. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
  56. package/dist/client/browser-entry/hydrate.d.ts +1 -1
  57. package/dist/client/browser-entry/router-init.d.ts.map +1 -1
  58. package/dist/client/error-boundary.d.ts +1 -0
  59. package/dist/client/error-boundary.d.ts.map +1 -1
  60. package/dist/client/error-boundary.js +1 -1
  61. package/dist/client/history.d.ts +4 -5
  62. package/dist/client/history.d.ts.map +1 -1
  63. package/dist/client/index.js +6 -7
  64. package/dist/client/index.js.map +1 -1
  65. package/dist/client/internal.d.ts +1 -1
  66. package/dist/client/internal.d.ts.map +1 -1
  67. package/dist/client/internal.js +194 -55
  68. package/dist/client/internal.js.map +1 -1
  69. package/dist/client/navigation-commit.d.ts +6 -25
  70. package/dist/client/navigation-commit.d.ts.map +1 -1
  71. package/dist/client/outlet-content-cache.d.ts +59 -0
  72. package/dist/client/outlet-content-cache.d.ts.map +1 -0
  73. package/dist/client/outlet-scope-context.d.ts +30 -0
  74. package/dist/client/outlet-scope-context.d.ts.map +1 -0
  75. package/dist/client/params-context.d.ts +10 -11
  76. package/dist/client/params-context.d.ts.map +1 -1
  77. package/dist/client/router-pipeline.d.ts +5 -5
  78. package/dist/client/router-pipeline.d.ts.map +1 -1
  79. package/dist/client/router-types.d.ts +10 -24
  80. package/dist/client/router-types.d.ts.map +1 -1
  81. package/dist/client/router.d.ts.map +1 -1
  82. package/dist/client/rsc-fetch.d.ts +4 -17
  83. package/dist/client/rsc-fetch.d.ts.map +1 -1
  84. package/dist/client/segment-cache.d.ts +15 -103
  85. package/dist/client/segment-cache.d.ts.map +1 -1
  86. package/dist/client/segment-outlet.d.ts +28 -52
  87. package/dist/client/segment-outlet.d.ts.map +1 -1
  88. package/dist/client/stale-segment.d.ts +39 -0
  89. package/dist/client/stale-segment.d.ts.map +1 -0
  90. package/dist/client/use-segment-params.d.ts +1 -1
  91. package/dist/config-types.d.ts +7 -6
  92. package/dist/config-types.d.ts.map +1 -1
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +9 -732
  95. package/dist/index.js.map +1 -1
  96. package/dist/native/rsc/manifest.json +6 -4
  97. package/dist/native/rsc/routing/segment-keys.js +3 -11
  98. package/dist/native/rsc/routing/segment-keys.js.map +1 -1
  99. package/dist/native/rsc/server/access-gate.js +3 -7
  100. package/dist/native/rsc/server/access-gate.js.map +1 -1
  101. package/dist/native/rsc/server/als-registry.js +2 -1
  102. package/dist/native/rsc/server/als-registry.js.map +1 -1
  103. package/dist/native/rsc/server/build-manifest.js.map +1 -1
  104. package/dist/native/rsc/server/chain-url-parts.js +1 -6
  105. package/dist/native/rsc/server/chain-url-parts.js.map +1 -1
  106. package/dist/native/rsc/server/client-state-tree.js +33 -0
  107. package/dist/native/rsc/server/client-state-tree.js.map +1 -0
  108. package/dist/native/rsc/server/flight-source-node.js +5 -2
  109. package/dist/native/rsc/server/flight-source-node.js.map +1 -1
  110. package/dist/native/rsc/server/flight-source.js +46 -7
  111. package/dist/native/rsc/server/flight-source.js.map +1 -1
  112. package/dist/native/rsc/server/pipeline-interception.js +1 -1
  113. package/dist/native/rsc/server/publish-params.js.map +1 -1
  114. package/dist/native/rsc/server/route-element-builder.js +43 -61
  115. package/dist/native/rsc/server/route-element-builder.js.map +1 -1
  116. package/dist/native/rsc/server/rsc-entry/helpers.js +5 -28
  117. package/dist/native/rsc/server/rsc-entry/helpers.js.map +1 -1
  118. package/dist/native/rsc/server/rsc-entry/render-route.js +33 -7
  119. package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
  120. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +2 -1
  121. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
  122. package/dist/native/rsc/server/rsc-entry/rsc-payload.js +2 -5
  123. package/dist/native/rsc/server/rsc-entry/rsc-payload.js.map +1 -1
  124. package/dist/native/rsc/server/rsc-entry/rsc-stream.js +44 -40
  125. package/dist/native/rsc/server/rsc-entry/rsc-stream.js.map +1 -1
  126. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +1 -1
  127. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js.map +1 -1
  128. package/dist/native/rsc/server/segment-hash/capture.js +107 -0
  129. package/dist/native/rsc/server/segment-hash/capture.js.map +1 -0
  130. package/dist/native/rsc/server/segment-hash/outlet.js +81 -0
  131. package/dist/native/rsc/server/segment-hash/outlet.js.map +1 -0
  132. package/dist/native/rsc/server/segment-hash/stream-tap.js +139 -0
  133. package/dist/native/rsc/server/segment-hash/stream-tap.js.map +1 -0
  134. package/dist/native/rsc/server/segment-hash/value-hash.js +171 -0
  135. package/dist/native/rsc/server/segment-hash/value-hash.js.map +1 -0
  136. package/dist/native/rsc/server/slot-resolver.js +20 -124
  137. package/dist/native/rsc/server/slot-resolver.js.map +1 -1
  138. package/dist/native/rsc/server/vite-handoff-rsc.js.map +1 -1
  139. package/dist/native/rsc/shared/outlet-decision.js +5 -0
  140. package/dist/native/rsc/shared/outlet-decision.js.map +1 -0
  141. package/dist/native/ssr/client/error-boundary.js +16 -3
  142. package/dist/native/ssr/client/error-boundary.js.map +1 -1
  143. package/dist/native/ssr/client/navigation-commit.js +1 -5
  144. package/dist/native/ssr/client/navigation-commit.js.map +1 -1
  145. package/dist/native/ssr/client/outlet-content-cache.js +53 -0
  146. package/dist/native/ssr/client/outlet-content-cache.js.map +1 -0
  147. package/dist/native/ssr/client/outlet-scope-context.js +12 -0
  148. package/dist/native/ssr/client/outlet-scope-context.js.map +1 -0
  149. package/dist/native/ssr/client/params-context.js.map +1 -1
  150. package/dist/native/ssr/client/rsc-fetch.js +1 -12
  151. package/dist/native/ssr/client/rsc-fetch.js.map +1 -1
  152. package/dist/native/ssr/client/segment-outlet.js +34 -13
  153. package/dist/native/ssr/client/segment-outlet.js.map +1 -1
  154. package/dist/native/ssr/client/stale-segment.js +29 -0
  155. package/dist/native/ssr/client/stale-segment.js.map +1 -0
  156. package/dist/native/ssr/manifest.json +5 -4
  157. package/dist/native/ssr/routing/segment-keys.js +5 -1
  158. package/dist/native/ssr/routing/segment-keys.js.map +1 -1
  159. package/dist/native/ssr/server/access-gate.js +3 -7
  160. package/dist/native/ssr/server/access-gate.js.map +1 -1
  161. package/dist/native/ssr/server/als-registry.js +1 -0
  162. package/dist/native/ssr/server/als-registry.js.map +1 -1
  163. package/dist/native/ssr/server/build-manifest.js.map +1 -1
  164. package/dist/native/ssr/server/client-state-tree.js +33 -0
  165. package/dist/native/ssr/server/client-state-tree.js.map +1 -0
  166. package/dist/native/ssr/server/flight-source-node.js +5 -2
  167. package/dist/native/ssr/server/flight-source-node.js.map +1 -1
  168. package/dist/native/ssr/server/flight-source.js +1 -0
  169. package/dist/native/ssr/server/flight-source.js.map +1 -1
  170. package/dist/native/ssr/server/pipeline-interception.js +1 -1
  171. package/dist/native/ssr/server/segment-hash/value-hash.js +162 -0
  172. package/dist/native/ssr/server/segment-hash/value-hash.js.map +1 -0
  173. package/dist/native/ssr/server/ssr-wrappers.js.map +1 -1
  174. package/dist/native/ssr/server/vite-handoff-rsc.js.map +1 -1
  175. package/dist/native/ssr/shared/payload-root.js.map +1 -1
  176. package/dist/plugin-context.d.ts +0 -16
  177. package/dist/plugin-context.d.ts.map +1 -1
  178. package/dist/plugins/build-manifest.d.ts.map +1 -1
  179. package/dist/routing/index.js +2 -2
  180. package/dist/routing/segment-keys.d.ts +8 -21
  181. package/dist/routing/segment-keys.d.ts.map +1 -1
  182. package/dist/server/access-gate.d.ts +0 -14
  183. package/dist/server/access-gate.d.ts.map +1 -1
  184. package/dist/server/als-registry.d.ts +16 -0
  185. package/dist/server/als-registry.d.ts.map +1 -1
  186. package/dist/server/build-manifest.d.ts +1 -10
  187. package/dist/server/build-manifest.d.ts.map +1 -1
  188. package/dist/server/chain-url-parts.d.ts +3 -13
  189. package/dist/server/chain-url-parts.d.ts.map +1 -1
  190. package/dist/server/client-state-tree.d.ts +31 -0
  191. package/dist/server/client-state-tree.d.ts.map +1 -0
  192. package/dist/server/flight-source-node.d.ts +6 -1
  193. package/dist/server/flight-source-node.d.ts.map +1 -1
  194. package/dist/server/flight-source.d.ts +27 -0
  195. package/dist/server/flight-source.d.ts.map +1 -1
  196. package/dist/server/index.js +2 -2
  197. package/dist/server/internal.js +48 -47
  198. package/dist/server/internal.js.map +1 -1
  199. package/dist/server/publish-params.d.ts +5 -4
  200. package/dist/server/publish-params.d.ts.map +1 -1
  201. package/dist/server/route-element-builder.d.ts +4 -19
  202. package/dist/server/route-element-builder.d.ts.map +1 -1
  203. package/dist/server/rsc-entry/helpers.d.ts +7 -13
  204. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  205. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  206. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
  207. package/dist/server/rsc-entry/rsc-payload.d.ts +1 -2
  208. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  209. package/dist/server/rsc-entry/rsc-stream.d.ts +11 -2
  210. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  211. package/dist/server/rsc-entry/ssr-renderer.d.ts +0 -2
  212. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  213. package/dist/server/segment-hash/capture.d.ts +77 -0
  214. package/dist/server/segment-hash/capture.d.ts.map +1 -0
  215. package/dist/server/segment-hash/outlet.d.ts +65 -0
  216. package/dist/server/segment-hash/outlet.d.ts.map +1 -0
  217. package/dist/server/segment-hash/stream-tap.d.ts +49 -0
  218. package/dist/server/segment-hash/stream-tap.d.ts.map +1 -0
  219. package/dist/server/segment-hash/value-hash.d.ts +70 -0
  220. package/dist/server/segment-hash/value-hash.d.ts.map +1 -0
  221. package/dist/server/slot-resolver.d.ts +13 -78
  222. package/dist/server/slot-resolver.d.ts.map +1 -1
  223. package/dist/server/ssr-wrappers.d.ts +7 -9
  224. package/dist/server/ssr-wrappers.d.ts.map +1 -1
  225. package/dist/server/vite-handoff-rsc.d.ts +10 -1
  226. package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
  227. package/dist/shared/outlet-decision.d.ts +48 -0
  228. package/dist/shared/outlet-decision.d.ts.map +1 -0
  229. package/dist/shared/payload-root.d.ts +5 -8
  230. package/dist/shared/payload-root.d.ts.map +1 -1
  231. package/dist/shared/segment-info.d.ts +13 -28
  232. package/dist/shared/segment-info.d.ts.map +1 -1
  233. package/package.json +1 -1
  234. package/src/client/browser-entry/action-dispatch.ts +1 -15
  235. package/src/client/browser-entry/hydrate.ts +3 -3
  236. package/src/client/browser-entry/router-init.ts +28 -47
  237. package/src/client/error-boundary.tsx +49 -9
  238. package/src/client/history.ts +4 -5
  239. package/src/client/internal.ts +1 -1
  240. package/src/client/navigation-commit.ts +25 -83
  241. package/src/client/outlet-content-cache.ts +119 -0
  242. package/src/client/outlet-scope-context.ts +42 -0
  243. package/src/client/params-context.ts +11 -12
  244. package/src/client/router-pipeline.ts +10 -74
  245. package/src/client/router-types.ts +11 -26
  246. package/src/client/router.ts +7 -22
  247. package/src/client/rsc-fetch.ts +5 -30
  248. package/src/client/segment-cache.ts +19 -264
  249. package/src/client/segment-outlet.tsx +80 -72
  250. package/src/client/stale-segment.ts +60 -0
  251. package/src/client/use-segment-params.ts +1 -1
  252. package/src/config-types.ts +7 -6
  253. package/src/index.ts +0 -2
  254. package/src/plugin-context.ts +0 -16
  255. package/src/plugins/build-manifest.ts +1 -22
  256. package/src/routing/scanner.ts +12 -0
  257. package/src/routing/segment-keys.ts +9 -35
  258. package/src/rsc-runtime/vendor-types.d.ts +8 -0
  259. package/src/server/access-gate.tsx +3 -32
  260. package/src/server/als-registry.ts +23 -0
  261. package/src/server/build-manifest.ts +1 -11
  262. package/src/server/chain-url-parts.ts +3 -21
  263. package/src/server/client-state-tree.ts +75 -0
  264. package/src/server/flight-source-node.ts +7 -2
  265. package/src/server/flight-source.ts +102 -9
  266. package/src/server/pipeline-interception.ts +1 -1
  267. package/src/server/publish-params.ts +5 -4
  268. package/src/server/route-element-builder.ts +77 -206
  269. package/src/server/rsc-entry/helpers.ts +11 -65
  270. package/src/server/rsc-entry/render-route.ts +54 -28
  271. package/src/server/rsc-entry/revalidate-renderer.ts +2 -1
  272. package/src/server/rsc-entry/rsc-payload.ts +11 -39
  273. package/src/server/rsc-entry/rsc-stream.ts +123 -101
  274. package/src/server/rsc-entry/ssr-renderer.ts +1 -3
  275. package/src/server/segment-hash/capture.ts +232 -0
  276. package/src/server/segment-hash/outlet.ts +185 -0
  277. package/src/server/segment-hash/stream-tap.ts +244 -0
  278. package/src/server/segment-hash/value-hash.ts +338 -0
  279. package/src/server/slot-resolver.ts +37 -323
  280. package/src/server/ssr-wrappers.tsx +7 -9
  281. package/src/server/vite-handoff-rsc.ts +12 -1
  282. package/src/shared/outlet-decision.ts +54 -0
  283. package/src/shared/payload-root.ts +5 -8
  284. package/src/shared/segment-info.ts +13 -28
  285. package/dist/_chunks/chains-CmzbpG-6.js +0 -1
  286. package/dist/_chunks/dev-server--4_Ogy_6.js +0 -1
  287. package/dist/_chunks/dev-span-RsVeYYc_.js.map +0 -1
  288. package/dist/_chunks/error-boundary-Bh-egWUI.js.map +0 -1
  289. package/dist/_chunks/flight-source-node-BsrlUjMO.js.map +0 -1
  290. package/dist/client/segment-update-context.d.ts +0 -15
  291. package/dist/client/segment-update-context.d.ts.map +0 -1
  292. package/dist/client/slot-content-cache-context.d.ts +0 -35
  293. package/dist/client/slot-content-cache-context.d.ts.map +0 -1
  294. package/dist/native/rsc/server/request-dep.js +0 -12
  295. package/dist/native/rsc/server/request-dep.js.map +0 -1
  296. package/dist/native/rsc/server/route-element-helpers.js +0 -20
  297. package/dist/native/rsc/server/route-element-helpers.js.map +0 -1
  298. package/dist/native/rsc/server/skippable-prefix.js +0 -72
  299. package/dist/native/rsc/server/skippable-prefix.js.map +0 -1
  300. package/dist/native/rsc/server/state-tree-diff.js +0 -35
  301. package/dist/native/rsc/server/state-tree-diff.js.map +0 -1
  302. package/dist/native/ssr/client/segment-cache.js +0 -119
  303. package/dist/native/ssr/client/segment-cache.js.map +0 -1
  304. package/dist/native/ssr/client/segment-update-context.js +0 -9
  305. package/dist/native/ssr/client/segment-update-context.js.map +0 -1
  306. package/dist/native/ssr/client/slot-content-cache-context.js +0 -8
  307. package/dist/native/ssr/client/slot-content-cache-context.js.map +0 -1
  308. package/dist/native/ssr/server/state-tree-diff.js +0 -23
  309. package/dist/native/ssr/server/state-tree-diff.js.map +0 -1
  310. package/dist/plugins/request-dep/analysis.d.ts +0 -106
  311. package/dist/plugins/request-dep/analysis.d.ts.map +0 -1
  312. package/dist/plugins/request-dep/index.d.ts +0 -75
  313. package/dist/plugins/request-dep/index.d.ts.map +0 -1
  314. package/dist/plugins/request-dep/origin.d.ts +0 -61
  315. package/dist/plugins/request-dep/origin.d.ts.map +0 -1
  316. package/dist/server/request-dep.d.ts +0 -15
  317. package/dist/server/request-dep.d.ts.map +0 -1
  318. package/dist/server/route-element-helpers.d.ts +0 -12
  319. package/dist/server/route-element-helpers.d.ts.map +0 -1
  320. package/dist/server/skippable-prefix.d.ts +0 -29
  321. package/dist/server/skippable-prefix.d.ts.map +0 -1
  322. package/dist/server/state-tree-diff.d.ts +0 -78
  323. package/dist/server/state-tree-diff.d.ts.map +0 -1
  324. package/src/client/segment-update-context.ts +0 -23
  325. package/src/client/slot-content-cache-context.ts +0 -43
  326. package/src/plugins/request-dep/analysis.ts +0 -447
  327. package/src/plugins/request-dep/index.ts +0 -376
  328. package/src/plugins/request-dep/origin.ts +0 -310
  329. package/src/server/request-dep.ts +0 -37
  330. package/src/server/route-element-helpers.ts +0 -37
  331. package/src/server/skippable-prefix.ts +0 -172
  332. package/src/server/state-tree-diff.ts +0 -132
@@ -1,12 +1,11 @@
1
- import { l as getRouterOrNull, r as parseRouterUrl, t as setHardNavigating } from "./navigation-root-Cvb7P1ud.js";
1
+ import { l as getRouterOrNull, r as parseRouterUrl, s as createGlobalContext, t as setHardNavigating } from "./navigation-root-Cvb7P1ud.js";
2
2
  import { a as _setStatusPageRendered, f as statusPageRendered, o as _setUnloading, p as unloading, r as _setOnStatusPageRendered, u as onStatusPageRendered } from "./state-B-EBjeER.js";
3
- import { n as createSingleflight } from "./singleflight-CzoOVB9Y.js";
4
3
  import { a as randomRscCacheKey, n as RSC_KEY_PARAM, o as recordLookup, s as rscCacheKey } from "./rsc-cache-key-D0cb0Gmc.js";
5
4
  import { i as withBasePath, r as stripBasePath } from "./base-path-DDIx0FXe.js";
6
5
  import { n as rscPayloadPath } from "./rsc-payload-path-EphpDB-J.js";
7
6
  import "./rsc-error-envelope-D6gNqh52.js";
8
7
  import { n as isRscContentType, t as RSC_CONTENT_TYPE } from "./rsc-media-type-m8jz9u6_.js";
9
- import { Component, createContext, createElement, useLayoutEffect } from "react";
8
+ import { Component, createContext, createElement, useContext, useEffect, useLayoutEffect, useRef } from "react";
10
9
  // src/shared/payload-root.ts
11
10
  /**
12
11
  * What a reader gets when the value it was handed is not a payload root.
@@ -70,343 +69,8 @@ function splitPayloadRoot(root) {
70
69
  params: Promise.resolve(settled).then(readPublishedParams, () => NO_PUBLISHED_PARAMS)
71
70
  };
72
71
  }
73
- // src/client/segment-cache.ts
74
- /**
75
- * Maintains the client-side segment tree representing currently mounted
76
- * layouts and pages. Used for navigation reconciliation — the router diffs
77
- * new routes against this tree to determine which segments to re-fetch.
78
- */
79
- var SegmentCache = class {
80
- root;
81
- /**
82
- * Monotonic counter. Bumped by `invalidateReuse()` (TIM-1466).
83
- * `serializeStateTree` suppresses `segments` and `slots` when
84
- * `reuseInvalidatedAt > reuseRestoredAt`. Only `restoreReuse()`
85
- * advances `reuseRestoredAt` — `set()` does not, because a
86
- * pre-invalidation navigation's commit thunk would lift suppression
87
- * before a post-invalidation request has been sent (codex on #1167).
88
- */
89
- reuseInvalidatedAt = 0;
90
- reuseRestoredAt = 0;
91
- get(segment) {
92
- if (segment === "/" || segment === this.root?.segment) return this.root;
93
- }
94
- set(segment, node) {
95
- if (segment === "/" || !this.root) this.root = node;
96
- }
97
- clear() {
98
- this.root = void 0;
99
- this.reuseRestoredAt = this.reuseInvalidatedAt;
100
- }
101
- /**
102
- * Suppress segment and slot reuse without destroying the tree
103
- * structure (TIM-1466). `serializeStateTree` sends empty
104
- * `segments`/`slots` (forcing a full render) while `treePaths`
105
- * still reflects the mounted tree for interception scoping.
106
- * Call `restoreReuse()` once post-invalidation data has been
107
- * fetched and committed.
108
- */
109
- invalidateReuse() {
110
- this.reuseInvalidatedAt++;
111
- }
112
- /**
113
- * Lift reuse suppression. Called after the segment cache has been
114
- * rebuilt from a response that was fetched with suppression active
115
- * (i.e. the server sent a full render). Safe to call idempotently.
116
- */
117
- restoreReuse() {
118
- this.reuseRestoredAt = this.reuseInvalidatedAt;
119
- }
120
- /** Whether segment/slot reuse is currently suppressed (TIM-1466). */
121
- isReuseSuppressed() {
122
- return this.reuseInvalidatedAt > this.reuseRestoredAt;
123
- }
124
- /**
125
- * Serialize the mounted segment tree for the X-Timber-State-Tree header.
126
- * Only includes sync segments — async segments are excluded because the
127
- * server must always re-render them (they may depend on request context).
128
- *
129
- * When mergeableFilter is provided, only segments whose paths are in the
130
- * set are included. This ensures the server only skips segments that the
131
- * client can actually merge (i.e., segments whose cached element tree
132
- * contains an inner SegmentProvider the merger can splice into).
133
- *
134
- * `treePaths` is collected UNFILTERED, unlike `segments` and `slots`. Those
135
- * two answer "what may the server skip re-rendering?", so every reason a
136
- * segment cannot be reused is a reason to leave it out. `treePaths` answers
137
- * "what is mounted right now?" for interception scoping — a request-dependent
138
- * layout is still on screen, and dropping it would silently narrow the scope
139
- * the server sees and cancel a modal that should open (TIM-1282).
140
- *
141
- * This is a performance optimization only, NOT a security boundary.
142
- * The server always runs all access.ts files regardless of the state tree.
143
- */
144
- serializeStateTree(mergeableFilter) {
145
- const segments = [];
146
- const slots = [];
147
- const treePaths = [];
148
- const suppressed = this.reuseInvalidatedAt > this.reuseRestoredAt;
149
- if (this.root) {
150
- if (!suppressed) {
151
- collectSyncSegments(this.root, segments, mergeableFilter);
152
- collectSyncSlots(this.root, slots);
153
- }
154
- collectTreePaths(this.root, treePaths);
155
- }
156
- const tree = { segments };
157
- if (slots.length > 0) tree.slots = slots;
158
- if (treePaths.length > 0) tree.treePaths = treePaths;
159
- return tree;
160
- }
161
- };
162
- /** Recursively collect sync segment paths from the tree */
163
- function collectSyncSegments(node, out, mergeableFilter) {
164
- if (!node.isRequestDependent && (!mergeableFilter || mergeableFilter.has(node.segment))) out.push(node.segment);
165
- for (const child of node.children.values()) collectSyncSegments(child, out, mergeableFilter);
166
- }
167
- /**
168
- * Recursively collect the `app/` directory path of every mounted segment.
169
- *
170
- * Slots are not walked: a slot's own sub-tree can never own an intercepting
171
- * slot's scope, because scopes are always ordinary segments (`interception.ts`
172
- * derives one from the slot owner's ancestor chain).
173
- */
174
- function collectTreePaths(node, out) {
175
- if (node.treePath) out.push(node.treePath);
176
- for (const child of node.children.values()) collectTreePaths(child, out);
177
- }
178
- /**
179
- * Recursively collect content keys from cacheable slots.
180
- *
181
- * The server advertises a content key per slot on every render (TIM-1370),
182
- * encoding the owner's URL parts, the slot name, the matched entry file,
183
- * and the slot's params. The client stores this key and sends it back on
184
- * the next navigation so the server can decide skips by key membership —
185
- * no departing URL reconstruction needed.
186
- */
187
- function collectSyncSlots(node, out) {
188
- if (node.slots) {
189
- for (const slot of node.slots.values()) if (!slot.isRequestDependent && !slot.denied && slot.contentKey) out.push(slot.contentKey);
190
- }
191
- for (const child of node.children.values()) collectSyncSlots(child, out);
192
- }
193
- /**
194
- * Build a SegmentNode tree from flat segment metadata.
195
- *
196
- * Takes an ordered list of segment descriptors (root → leaf) from the
197
- * server's X-Timber-Segments header and constructs the hierarchical
198
- * tree structure that SegmentCache expects.
199
- *
200
- * Each segment is nested as a child of the previous one, forming a
201
- * linear chain from root to leaf. The leaf segment (page) is excluded
202
- * from the tree — pages are never cached across navigations.
203
- */
204
- function buildSegmentTree(segments) {
205
- if (segments.length === 0) return void 0;
206
- const segmentEntries = [];
207
- const slotEntries = [];
208
- for (const info of segments) if (info.slot) slotEntries.push(info);
209
- else segmentEntries.push(info);
210
- let root;
211
- let parent;
212
- const nodeById = /* @__PURE__ */ new Map();
213
- for (const info of segmentEntries) {
214
- const id = info.segmentId ?? info.path;
215
- const node = {
216
- segment: id,
217
- treePath: info.treePath,
218
- payload: null,
219
- isRequestDependent: info.isRequestDependent,
220
- children: /* @__PURE__ */ new Map()
221
- };
222
- nodeById.set(id, node);
223
- if (!root) root = node;
224
- if (parent) parent.children.set(id, node);
225
- parent = node;
226
- }
227
- for (const slotInfo of slotEntries) {
228
- const parentId = slotInfo.parentSegment;
229
- const parentNode = parentId ? nodeById.get(parentId) : root;
230
- if (!parentNode) continue;
231
- const slotId = slotInfo.segmentId ?? slotInfo.path;
232
- const slotNode = {
233
- segment: slotId,
234
- payload: null,
235
- isRequestDependent: slotInfo.isRequestDependent,
236
- children: /* @__PURE__ */ new Map(),
237
- denied: slotInfo.denied,
238
- contentKey: slotInfo.contentKey
239
- };
240
- if (!parentNode.slots) parentNode.slots = /* @__PURE__ */ new Map();
241
- parentNode.slots.set(slotId, slotNode);
242
- }
243
- return root;
244
- }
245
- /** Sentinel value for negative cache entries (URL is not a route). */
246
- var NEGATIVE_ENTRY = Object.freeze({ payload: null });
247
- /**
248
- * Timeout for the in-flight singleflight (TIM-1438). Per CLAUDE.md's
249
- * singleflight rule: "Never write a coalescing Map without a timeout."
250
- * A hung prefetch cannot block clicks or suppress hovers forever.
251
- */
252
- var PREFETCH_SINGLEFLIGHT_TIMEOUT_MS = 5e3;
253
- /**
254
- * Compose the map key. Length-prefixed rather than delimiter-joined for the
255
- * same reason `shared/rsc-cache-key.ts` is: any delimiter is forgeable by a
256
- * value containing it, and a URL may contain any character a delimiter could.
257
- */
258
- function prefetchMapKey(key) {
259
- return `${key.from.length}:${key.from}:${key.scope.length}:${key.scope}:${key.url}`;
260
- }
261
- /**
262
- * The `scope` half of a `PrefetchKey`, derived from the state tree that will
263
- * actually be sent. Taking it from the header value rather than re-walking the
264
- * cache is the point: the key varies by exactly what the request varies by.
265
- */
266
- function prefetchScopeOf(stateTree) {
267
- return stateTree?.treePaths?.join("\0") ?? "";
268
- }
269
- /**
270
- * Short-lived cache for hover-triggered prefetches. Entries expire after
271
- * 30 seconds. When a link is clicked, the prefetched payload is consumed
272
- * (moved to the history stack) and removed from this cache.
273
- *
274
- * In-flight dedup (TIM-1438): concurrent fetches for the same key are
275
- * coalesced by a `createSingleflight` instance. A hover starts a flight;
276
- * a click for the same key joins it instead of issuing a duplicate. The
277
- * singleflight enforces a 5-second timeout and cleans up automatically
278
- * on settlement.
279
- *
280
- * timber.js does NOT prefetch on viewport intersection — only explicit
281
- * hover on <Link prefetch> triggers a prefetch.
282
- */
283
- var PrefetchCache = class PrefetchCache {
284
- static TTL_MS = 3e4;
285
- entries = /* @__PURE__ */ new Map();
286
- flights = createSingleflight({ timeoutMs: PREFETCH_SINGLEFLIGHT_TIMEOUT_MS });
287
- evictionGen = 0;
288
- set(key, result) {
289
- this.entries.set(prefetchMapKey(key), {
290
- result,
291
- expiresAt: Date.now() + PrefetchCache.TTL_MS
292
- });
293
- }
294
- get(key) {
295
- const mapKey = prefetchMapKey(key);
296
- const entry = this.entries.get(mapKey);
297
- if (!entry) return void 0;
298
- if (Date.now() >= entry.expiresAt) {
299
- this.entries.delete(mapKey);
300
- return;
301
- }
302
- return entry.result;
303
- }
304
- /** True if a ready or negative entry exists for this key. */
305
- has(key) {
306
- return this.get(key) !== void 0;
307
- }
308
- /** Get and remove the entry (used when navigation consumes a prefetch) */
309
- consume(key) {
310
- const result = this.get(key);
311
- if (result !== void 0) this.entries.delete(prefetchMapKey(key));
312
- return result;
313
- }
314
- /**
315
- * Fetch or coalesce with an in-flight fetch for this key (TIM-1438).
316
- *
317
- * Concurrent callers (hover + click, repeated hovers) get the same
318
- * promise. On success the result is stored as a ready entry. On
319
- * NonRscResponse a negative entry is stored and the outcome is
320
- * `{ kind: 'non-route' }`. Other errors (network, version skew)
321
- * reject — the singleflight cleans up the key and subsequent callers
322
- * retry.
323
- *
324
- * The singleflight signal is passed to `doFetch` so a timed-out flight
325
- * aborts the underlying fetch rather than leaving it running.
326
- */
327
- fetchOrCoalesce(key, doFetch, isNonRoute) {
328
- const genAtStart = this.evictionGen;
329
- return this.flights.do(prefetchMapKey(key), async (signal) => {
330
- try {
331
- const result = await doFetch(signal);
332
- if (!signal.aborted && this.evictionGen === genAtStart) this.set(key, result);
333
- return {
334
- kind: "ready",
335
- result,
336
- startGen: genAtStart
337
- };
338
- } catch (err) {
339
- if (isNonRoute(err)) {
340
- if (!signal.aborted && this.evictionGen === genAtStart) this.setNegative(key);
341
- return {
342
- kind: "non-route",
343
- startGen: genAtStart
344
- };
345
- }
346
- throw err;
347
- }
348
- });
349
- }
350
- /**
351
- * Join an in-flight singleflight fetch if one exists for this key.
352
- * Returns the in-flight promise or undefined. Used by the click path to
353
- * coalesce with a hover prefetch without starting a new flight — when no
354
- * flight exists, the click issues its own fetch with the navigation's
355
- * abort signal so superseded navigations abort immediately (TIM-1438).
356
- */
357
- joinInflight(key) {
358
- return this.flights.get(prefetchMapKey(key));
359
- }
360
- /**
361
- * Store a negative entry — the URL is not a route (non-RSC Content-Type).
362
- *
363
- * Keyed like every other entry even though "not a route" does not actually
364
- * vary by departing URL: a source-independent negative would be a second
365
- * keying rule to keep correct, and the only cost of the uniform one is a
366
- * repeated fetch for a link hovered from a second page.
367
- */
368
- setNegative(key) {
369
- this.set(key, NEGATIVE_ENTRY);
370
- }
371
- /** Check if the entry is a negative cache entry (URL is not a route). */
372
- isNegative(key) {
373
- return this.get(key) === NEGATIVE_ENTRY;
374
- }
375
- /**
376
- * Evict all ready entries and fence in-flight singleflights (TIM-1476).
377
- * Called after a server action that revalidated data — the mutation may
378
- * affect any route, not just the paths the server named. In-flight
379
- * singleflights are not aborted (they may carry post-mutation data),
380
- * but their results are discarded if they complete after eviction:
381
- * `fetchOrCoalesce` captures the generation before the flight and
382
- * skips the store when it has been bumped.
383
- *
384
- * Consumers that join an in-flight flight via `joinInflight` must
385
- * check `getEvictionGen()` before and after the await: if the gen
386
- * changed, the result predates the eviction and must be discarded
387
- * (codex on #1131 round 2).
388
- */
389
- clearReady() {
390
- this.entries.clear();
391
- this.evictionGen++;
392
- }
393
- getEvictionGen() {
394
- return this.evictionGen;
395
- }
396
- };
397
72
  // src/client/navigation-commit.ts
398
73
  /**
399
- * What it means for a page to be "current" on the client.
400
- *
401
- * One module owns every write that makes a navigation's destination the
402
- * current page, and the read that describes the current page back to the
403
- * server. Keeping them together is the point: `X-Timber-State-Tree` is
404
- * derived from the segment cache, so the thing that publishes and the thing
405
- * that reports have to agree about when a page becomes current.
406
- *
407
- * See design/19-client-navigation.md §"State Update Invariants".
408
- */
409
- /**
410
74
  * Record that a status page for the main route is on screen. Called from
411
75
  * `StatusPageMarker`'s layout effect; consumed by the commit of the
412
76
  * navigation whose tree it belongs to, and acted on immediately for the
@@ -416,32 +80,6 @@ function reportStatusPageRendered() {
416
80
  _setStatusPageRendered(true);
417
81
  onStatusPageRendered?.();
418
82
  }
419
- /** Whether a response skipped layouts — its payload merges over the tree on screen. */
420
- function isPartialNavigation(skippedSegments) {
421
- return skippedSegments != null && skippedSegments.length > 0;
422
- }
423
- /**
424
- * Whether a payload can stand on its own when replayed from the history
425
- * stack. See `NavigationCommitInput.skippedSegments`.
426
- */
427
- function isReplayable(opts) {
428
- return !isPartialNavigation(opts.skippedSegments) && !hasSkippedSlot(opts.segmentInfo);
429
- }
430
- function hasSkippedSlot(segmentInfo) {
431
- return segmentInfo?.some((s) => s.slot && s.skipped) ?? false;
432
- }
433
- /**
434
- * The metadata a committed page keeps — on its history entry, and as the
435
- * current page's `committedSegmentInfo()`. `skipped` describes the
436
- * *response* — "this slot's content was omitted" — and neither stores such
437
- * a payload (the entry stores null). Kept, the flag outlives the response:
438
- * `applyActionResult()` reuses the current page's metadata beside a full
439
- * re-render and would have that judged non-replayable too.
440
- */
441
- function storedSegmentInfo(segmentInfo) {
442
- if (!hasSkippedSlot(segmentInfo)) return segmentInfo;
443
- return segmentInfo.map(({ skipped: _skipped, ...rest }) => rest);
444
- }
445
83
  /**
446
84
  * Derive the navigation state (pathname + search) a URL renders with.
447
85
  *
@@ -460,27 +98,14 @@ function createNavigationCommitter(deps) {
460
98
  const { segmentCache, historyStack } = deps;
461
99
  let committedSegmentInfo = null;
462
100
  _setOnStatusPageRendered(() => segmentCache.clear());
463
- /**
464
- * Update the segment cache from server-provided segment metadata.
465
- *
466
- * Runs whether or not `clientSegmentCache` is enabled: the tree is also
467
- * where the mounted tree paths come from, and those cross on every
468
- * navigation. What the flag gates is which parts get serialized — see
469
- * `currentStateTree`.
470
- */
471
- function updateSegmentCache(segmentInfo) {
472
- const tree = buildSegmentTree(segmentInfo);
473
- if (tree) segmentCache.set("/", tree);
474
- }
475
101
  return {
476
102
  committedSegmentInfo: () => committedSegmentInfo,
477
- isSegmentReuseSuppressed: () => segmentCache.isReuseSuppressed(),
478
- restoreSegmentReuse: () => segmentCache.restoreReuse(),
479
103
  /**
480
104
  * The X-Timber-State-Tree to send with the next RSC request.
481
105
  *
482
- * Two different things travel on one header. `segments`/`slots` are the
483
- * caching opt-in and are omitted unless `clientSegmentCache` is on.
106
+ * Two different things travel on one header. `hashes` are the caching
107
+ * opt-in — the segment hashes the client holds content for — and are
108
+ * omitted unless `clientSegmentCache` is on (design/52).
484
109
  * `treePaths` is how the server learns which route is actually mounted,
485
110
  * which stops being derivable from the address bar as soon as a modal is
486
111
  * open — so it crosses regardless (TIM-1282). Undefined when there is
@@ -491,12 +116,14 @@ function createNavigationCommitter(deps) {
491
116
  * (TIM-1301).
492
117
  */
493
118
  currentStateTree() {
494
- const tree = segmentCache.serializeStateTree();
495
- if (deps.clientSegmentCache()) return tree;
496
- return tree.treePaths ? {
497
- segments: [],
498
- treePaths: tree.treePaths
499
- } : void 0;
119
+ const tree = {};
120
+ const treePaths = segmentCache.treePaths();
121
+ if (treePaths.length > 0) tree.treePaths = treePaths;
122
+ if (deps.clientSegmentCache()) {
123
+ const hashes = deps.outletHashes();
124
+ if (Object.keys(hashes).length > 0) tree.hashes = hashes;
125
+ }
126
+ return tree.treePaths || tree.hashes ? tree : void 0;
500
127
  },
501
128
  /**
502
129
  * Prepare all navigation-owned state for a new page — without publishing
@@ -529,7 +156,7 @@ function createNavigationCommitter(deps) {
529
156
  */
530
157
  prepareNavigation(url, opts) {
531
158
  const navState = deriveNavigationState(url);
532
- const payload = isReplayable(opts) ? opts.payload : null;
159
+ const payload = opts.payload;
533
160
  _setStatusPageRendered(false);
534
161
  return {
535
162
  navState,
@@ -537,9 +164,9 @@ function createNavigationCommitter(deps) {
537
164
  const cacheable = !statusPageRendered;
538
165
  _setStatusPageRendered(false);
539
166
  const segmentInfo = cacheable ? opts.segmentInfo : [];
540
- if (segmentInfo && segmentInfo.length > 0) updateSegmentCache(segmentInfo);
167
+ if (segmentInfo && segmentInfo.length > 0) segmentCache.record(segmentInfo);
541
168
  else if (segmentInfo?.length === 0 || opts.clearSegmentCacheOnEmpty) segmentCache.clear();
542
- committedSegmentInfo = storedSegmentInfo(segmentInfo) ?? null;
169
+ committedSegmentInfo = segmentInfo ?? null;
543
170
  historyStack.push(url, {
544
171
  payload,
545
172
  params: opts.params,
@@ -735,9 +362,9 @@ function warnMalformedHeader(headerName, raw) {
735
362
  * Extract segment metadata from the X-Timber-Segments response header.
736
363
  * Returns null if the header is missing or malformed.
737
364
  *
738
- * Format: JSON array of {path, isRequestDependent} objects describing the rendered
739
- * segment chain from root to leaf. Used to populate the client-side
740
- * segment cache for state tree diffing on subsequent navigations.
365
+ * Format: JSON array of {path, segmentId?, treePath?} objects describing the
366
+ * mounted layout-bearing segments from root to leaf. The client reports the
367
+ * tree paths back for interception scoping (TIM-1282).
741
368
  */
742
369
  function extractSegmentInfo(response) {
743
370
  const header = response.headers.get("X-Timber-Segments");
@@ -750,25 +377,6 @@ function extractSegmentInfo(response) {
750
377
  }
751
378
  }
752
379
  /**
753
- * Extract skipped segment paths from the X-Timber-Skipped-Segments header.
754
- * Returns null if the header is missing or malformed.
755
- *
756
- * When the server skips sync layouts the client already has cached,
757
- * it sends this header listing the skipped segment paths (outermost first).
758
- * The client uses this to merge the partial payload with cached segments.
759
- */
760
- function extractSkippedSegments(response) {
761
- const header = response.headers.get("X-Timber-Skipped-Segments");
762
- if (!header) return null;
763
- try {
764
- const parsed = JSON.parse(header);
765
- return Array.isArray(parsed) ? parsed : null;
766
- } catch {
767
- warnMalformedHeader("X-Timber-Skipped-Segments", header);
768
- return null;
769
- }
770
- }
771
- /**
772
380
  * Thrown when an RSC payload response contains X-Timber-Redirect header.
773
381
  * Caught in navigate() to trigger a soft router navigation to the redirect target.
774
382
  */
@@ -886,7 +494,6 @@ async function fetchRscPayload(url, deps, stateTree, currentUrl, signal) {
886
494
  signal
887
495
  });
888
496
  let segmentInfo = null;
889
- let skippedSegments = null;
890
497
  let streamDone = Promise.resolve();
891
498
  const wrappedPromise = fetchPromise.then((response) => {
892
499
  if (checkReloadSignal(response)) throw new VersionSkewError();
@@ -904,7 +511,6 @@ async function fetchRscPayload(url, deps, stateTree, currentUrl, signal) {
904
511
  throw new NonRscResponse(url);
905
512
  }
906
513
  segmentInfo = extractSegmentInfo(response);
907
- skippedSegments = extractSkippedSegments(response);
908
514
  if (response.body) {
909
515
  const tracked = trackStreamCompletion(response.body);
910
516
  streamDone = tracked.done;
@@ -927,8 +533,7 @@ async function fetchRscPayload(url, deps, stateTree, currentUrl, signal) {
927
533
  payload,
928
534
  params,
929
535
  decodePromise,
930
- segmentInfo,
931
- skippedSegments
536
+ segmentInfo
932
537
  };
933
538
  }
934
539
  // src/client/unload-guard.ts
@@ -1340,6 +945,30 @@ function hardNavigate(url, fromUrl) {
1340
945
  window.location.reload();
1341
946
  } else window.location.href = url;
1342
947
  }
948
+ // src/client/outlet-scope-context.ts
949
+ /**
950
+ * OutletScopeContext — the decisions a skipped outlet hands to the outlets
951
+ * nested directly inside it.
952
+ *
953
+ * A skipped outlet renders its cached content, and that content still holds
954
+ * the nested `SegmentOutlet` elements from when it was committed — with
955
+ * their old decisions. The skip carries the new ones (`SkipDecision.outlets`)
956
+ * and provides them here, so each old outlet element renders its segment's
957
+ * new decision in place: same element type, same position, so React keeps
958
+ * every component's state below it.
959
+ *
960
+ * Every `SegmentOutlet` provides a scope to its content — the skip's
961
+ * decisions, or none — so the element structure is the same whether a
962
+ * segment was sent or skipped.
963
+ *
964
+ * Singleton across bundler-duplicated chunks via `createGlobalContext`.
965
+ * See design/52-segment-hash-dedupe.md §"Wire format".
966
+ */
967
+ var LIVE_OUTLET_SCOPE = Object.freeze({
968
+ skipped: false,
969
+ decisions: /* @__PURE__ */ new Map()
970
+ });
971
+ var OutletScopeContext = createGlobalContext(Symbol.for("__timber_outlet_scope_ctx"), LIVE_OUTLET_SCOPE);
1343
972
  // src/client/status-page-marker.tsx
1344
973
  /**
1345
974
  * The one way a status page tells the router it is on screen.
@@ -1387,6 +1016,35 @@ function errorDigestId(error) {
1387
1016
  const errorId = Reflect.get(parsed, "errorId");
1388
1017
  return Reflect.get(parsed, "type") === "error" && typeof errorId === "string" ? errorId : null;
1389
1018
  }
1019
+ // src/client/stale-segment.ts
1020
+ /** A recovery in flight: a second stale segment during it leaves the SPA. */
1021
+ var recovering = false;
1022
+ /**
1023
+ * Answer a stale segment by fetching the page again inside the SPA. The new
1024
+ * request advertises only what the client holds now, so every skip it gets
1025
+ * names content that is there. A navigation still in flight is re-requested;
1026
+ * otherwise the page on the address bar — a traversal has already moved it —
1027
+ * is refreshed, which sends no hashes at all.
1028
+ *
1029
+ * Returns false when the caller should leave the SPA instead: there is no
1030
+ * router, or this miss happened while recovering from the last one.
1031
+ */
1032
+ function recoverFromStaleSegment(router) {
1033
+ if (!router || recovering) return false;
1034
+ recovering = true;
1035
+ const pending = router.getPendingUrl();
1036
+ const done = () => {
1037
+ recovering = false;
1038
+ };
1039
+ queueMicrotask(() => {
1040
+ const handle = pending ? router.navigate(pending, {
1041
+ replace: true,
1042
+ scroll: false
1043
+ }) : router.refresh();
1044
+ Promise.resolve(handle).then(done, done);
1045
+ });
1046
+ return true;
1047
+ }
1390
1048
  // src/client/error-boundary.tsx
1391
1049
  /**
1392
1050
  * Framework-injected React error boundary.
@@ -1416,6 +1074,24 @@ var DenyAncestryContext = createContext([]);
1416
1074
  var _handledRedirects = /* @__PURE__ */ new WeakSet();
1417
1075
  var _handledExits = /* @__PURE__ */ new WeakSet();
1418
1076
  var _pendingRedirectLocation = null;
1077
+ /**
1078
+ * Resets a boundary showing an error once a new navigation reaches it.
1079
+ *
1080
+ * Live content resets the boundary through new `children`. Content a skip
1081
+ * reuses (design/52) is the same element tree as before — the boundary sees
1082
+ * the same `children` and would keep showing the old error, never mounting
1083
+ * the nested outlet that holds the new decision. What a skip does change is
1084
+ * the outlet scope: a new one for every decision. A scope other than the one
1085
+ * the error was shown under is a navigation that reached this boundary.
1086
+ */
1087
+ function ResetOnNewDecisions({ reset, children }) {
1088
+ const scope = useContext(OutletScopeContext);
1089
+ const shownUnder = useRef(scope);
1090
+ useEffect(() => {
1091
+ if (scope !== shownUnder.current) reset();
1092
+ }, [scope, reset]);
1093
+ return children;
1094
+ }
1419
1095
  var TimberErrorBoundary = class extends Component {
1420
1096
  constructor(props) {
1421
1097
  super(props);
@@ -1458,7 +1134,9 @@ var TimberErrorBoundary = class extends Component {
1458
1134
  }
1459
1135
  render() {
1460
1136
  if (!this.state.hasError || !this.state.error) return createElement(DenyAncestryContext.Provider, { value: this.childAncestry }, this.props.children);
1461
- const error = this.state.error;
1137
+ return createElement(ResetOnNewDecisions, { reset: this.reset }, this.fallback(this.state.error));
1138
+ }
1139
+ fallback(error) {
1462
1140
  const parsed = parseDigest(error);
1463
1141
  if (parsed?.type === "redirect") {
1464
1142
  if (typeof window === "undefined") throw error;
@@ -1479,7 +1157,7 @@ var TimberErrorBoundary = class extends Component {
1479
1157
  return this.markStatusPage(null);
1480
1158
  }
1481
1159
  const leavesSpa = parsed?.type !== "deny" || parsed.leaveSpa === true;
1482
- if (parsed?.type === "deny" && parsed.leaveSpa && !this.props.lastResort) throw error;
1160
+ if (parsed && "leaveSpa" in parsed && parsed.leaveSpa && !this.props.lastResort) throw error;
1483
1161
  if (parsed?.type === "deny" && Array.isArray(parsed.owners) && parsed.owners.length > 0) {
1484
1162
  if (!this.props.lastResort && !this.props.isSlotBoundary) {
1485
1163
  const reachable = parsed.owners.find((k) => this.childAncestry.includes(k));
@@ -1492,6 +1170,7 @@ var TimberErrorBoundary = class extends Component {
1492
1170
  if (!_handledExits.has(error)) {
1493
1171
  _handledExits.add(error);
1494
1172
  const router = getRouterOrNull();
1173
+ if (parsed?.type === "stale-segment" && recoverFromStaleSegment(router)) return null;
1495
1174
  const current = window.location.pathname + window.location.search;
1496
1175
  const target = router?.getPendingUrl() ?? current;
1497
1176
  queueMicrotask(() => {
@@ -1603,6 +1282,6 @@ function statusMatches(boundaryStatus, errorStatus) {
1603
1282
  if (boundaryStatus === 500) return errorStatus >= 500 && errorStatus <= 599;
1604
1283
  return boundaryStatus === errorStatus;
1605
1284
  }
1606
- export { readPayloadTree as _, createSpaExits as a, createRenderOwner as c, fetchRscPayload as d, createNavigationCommitter as f, prefetchScopeOf as g, SegmentCache as h, createScrollEffects as i, isClientStale as l, PrefetchCache as m, TimberErrorBoundary as n, runAsHandle as o, isPartialNavigation as p, createNavigationRecovery as r, recordSkew as s, DenyAncestryContext as t, NonRscResponse as u, readPublishedParams as v };
1285
+ export { createSpaExits as a, createRenderOwner as c, fetchRscPayload as d, createNavigationCommitter as f, createScrollEffects as i, isClientStale as l, readPublishedParams as m, TimberErrorBoundary as n, runAsHandle as o, readPayloadTree as p, createNavigationRecovery as r, recordSkew as s, DenyAncestryContext as t, NonRscResponse as u };
1607
1286
 
1608
- //# sourceMappingURL=error-boundary-Bh-egWUI.js.map
1287
+ //# sourceMappingURL=error-boundary-DB51f9ih.js.map