@rshono/core 1.0.0-rc.27 → 1.0.0-rc.29
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.
- package/README.md +5 -4
- package/dist/cli/dev.js +32 -1
- package/dist/cli/dev.js.map +1 -1
- package/dist/deploy/node/runtime.js +16 -2
- package/dist/deploy/node/runtime.js.map +1 -1
- package/dist/router.d.ts +9 -8
- package/dist/router.js.map +1 -1
- package/dist/runtime/client.d.ts +1 -1
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/control.js +12 -1
- package/dist/runtime/control.js.map +1 -1
- package/dist/runtime/dev-protocol.d.ts +10 -0
- package/dist/runtime/dev-protocol.js.map +1 -1
- package/dist/runtime/entry.client.js +592 -127
- package/dist/runtime/entry.client.js.map +1 -1
- package/dist/runtime/entry.rsc.js +41 -9
- package/dist/runtime/entry.rsc.js.map +1 -1
- package/dist/runtime/navigation-preparation.d.ts +52 -0
- package/dist/runtime/navigation-preparation.js +155 -0
- package/dist/runtime/navigation-preparation.js.map +1 -0
- package/dist/runtime/navigation-transition.d.ts +6 -0
- package/dist/runtime/navigation-transition.js +62 -0
- package/dist/runtime/navigation-transition.js.map +1 -0
- package/dist/runtime/navigation.d.ts +28 -26
- package/dist/runtime/navigation.js +50 -47
- package/dist/runtime/navigation.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.client.js","sourceRoot":"","sources":["../../src/runtime/entry.client.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGpE,sGAAsG;AACtG,6CAA6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AO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;IACrG,CAAC,CAAC;AACJ,CAAC;AAED,mGAAmG;AACnG,kFAAkF;AAClF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACrE,SAAS,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport {\n createFromFetch,\n createFromReadableStream,\n createTemporaryReferenceSet,\n encodeReply,\n setServerCallback,\n} from 'react-server-dom-rspack/client.browser';\nimport { isControlDigest, parseRedirectDigest } from './control.js';\nimport type { DevMessage } from './dev-protocol.js';\nimport type { RscPayload } from './entry.rsc.js';\n// Dev-only: its one caller sits behind `import.meta.webpackHot`, which a production build compiles to\n// `false` — so this module is dropped there.\nimport { walkHotUpdates } from './hot-update.js';\nimport { RouterContext, type NavigationRouter } from './navigation.js';\nimport { createRscRequest } from './request.js';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\ndeclare global {\n /** The array the payload `<script>` tags `flight-inject.ts` emits push their chunks into. */\n var __FLIGHT_DATA: Array<string | Uint8Array> | undefined;\n}\n\n/** The flight payload the document carried, read back out of `__FLIGHT_DATA` — see `flight-inject.ts`. */\nfunction readFlightPayload(): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n // Assigned synchronously by `start`, which `new ReadableStream` runs before it returns.\n let controller!: ReadableStreamDefaultController<Uint8Array>;\n const stream = new ReadableStream<Uint8Array>({\n start: (c) => void (controller = c),\n });\n const enqueue = (chunk: string | Uint8Array) => controller.enqueue(typeof chunk === 'string' ? encoder.encode(chunk) : chunk);\n\n // Payload scripts interleave with the document: the ones that already ran are in the array, the rest\n // arrive through `push`.\n const data = (self.__FLIGHT_DATA ??= []);\n for (const chunk of data) enqueue(chunk);\n data.push = enqueue as typeof data.push;\n\n // The last payload script lands before parsing finishes, so that is what closes the stream.\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => controller.close(), { once: true });\n } else {\n controller.close();\n }\n return stream;\n}\n\n/** Created at module evaluation, not inside `main()`, so no chunk can be pushed before it is watching. */\nconst flightStream = readFlightPayload();\n\n/**\n * The part of the location a payload is rendered for — the document, without the fragment, which the server\n * never sees. Two URLs that differ only by `#hash` describe the same payload.\n */\nconst documentUrl = (): string => location.pathname + location.search;\n\n/**\n * The document URL the payload on screen was rendered for — see {@link documentUrl}. A fragment-only\n * traversal leaves it unchanged, which is how the `popstate` listener knows there is nothing to fetch.\n * Updated in the layout effect that commits a payload.\n */\nlet renderedUrl = documentUrl();\n\n/** Guarantees somewhere to attach the fatal overlay: the root container is `document`, so a teardown can take `<body>` with it. */\nfunction overlayHost(): HTMLElement {\n if (!document.documentElement) document.appendChild(document.createElement('html'));\n if (!document.body) document.documentElement.appendChild(document.createElement('body'));\n return document.body;\n}\n\n/**\n * Paints a full-viewport panel over whatever is on screen, and returns the box for the caller to fill.\n *\n * DOM calls rather than React (one caller runs because the renderer just failed), and `textContent` rather\n * than `innerHTML` (an error message is untrusted input). Queued on a macrotask: React's teardown runs after\n * the callback that reaches here returns, and would remove a node appended inline.\n */\nfunction paintOverlay(fill: (box: HTMLElement) => void): void {\n setTimeout(() => {\n const host = overlayHost();\n host.querySelector('[data-rshono-fatal]')?.remove();\n\n const box = document.createElement('div');\n box.setAttribute('data-rshono-fatal', '');\n box.setAttribute('role', 'alert');\n box.style.cssText =\n 'position:fixed;inset:0;z-index:2147483647;overflow:auto;padding:1.5rem;background:#18181b;color:#f4f4f5;' +\n 'font:14px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace;text-align:left';\n\n fill(box);\n host.appendChild(box);\n }, 0);\n}\n\n/** The overlay's heading. */\nfunction overlayTitle(text: string): HTMLElement {\n const title = document.createElement('div');\n title.textContent = text;\n title.style.cssText = 'font-size:1.0625rem;font-weight:700;color:#f87171;margin:0 0 0.75rem';\n return title;\n}\n\n/**\n * Paints the reason for an uncaught render error over the blank page it leaves behind — the full stack in\n * dev, a generic notice and a reload button in production.\n */\nfunction showFatal(error: unknown, componentStack?: string | null): void {\n paintOverlay((box) => {\n box.appendChild(overlayTitle(isDev ? 'Unhandled error' : 'Something went wrong'));\n\n if (isDev) {\n const detail = document.createElement('pre');\n detail.style.cssText = 'margin:0;white-space:pre-wrap;word-break:break-word';\n detail.textContent =\n (error instanceof Error ? (error.stack ?? `${error.name}: ${error.message}`) : String(error)) +\n (componentStack ? `\\n\\nComponent stack:${componentStack}` : '');\n box.appendChild(detail);\n } else {\n const message = document.createElement('p');\n message.textContent = 'This page hit an unexpected error and can’t continue.';\n message.style.cssText = 'margin:0 0 1rem;color:#d4d4d8';\n box.appendChild(message);\n }\n\n const reload = document.createElement('button');\n reload.textContent = 'Reload page';\n reload.style.cssText =\n 'margin-top:1.25rem;padding:0.5rem 1rem;font:inherit;color:#18181b;background:#f4f4f5;border:0;border-radius:4px;cursor:pointer';\n reload.addEventListener('click', () => loadDocument());\n box.appendChild(reload);\n });\n}\n\n/**\n * The end of the line for a `notFound()` that arrived too late to be a 404 and did not survive a reload.\n *\n * No reload button, unlike {@link showFatal}: the reload has already been spent, and the second identical\n * response is what brought us here. \"Page not found\" is what the server was trying to say, so it is what the\n * visitor is told; the reason it could not say it properly is a message for whoever wrote the page, and dev is\n * where they are.\n */\nfunction showLateNotFound(): void {\n paintOverlay((box) => {\n box.appendChild(overlayTitle('Page not found'));\n\n const message = document.createElement('p');\n message.textContent = isDev\n ? 'notFound() was raised from a boundary that resolved after the page shell had been sent, so the response ' +\n 'could not be a 404 — and reloading rendered the same page again. Decide before the render starts ' +\n 'streaming: in Hono middleware, or in the page component body above the boundary.'\n : 'This page is not available.';\n message.style.cssText = 'margin:0;color:#d4d4d8';\n box.appendChild(message);\n });\n}\n/** What every flight response is typed as. The charset and any other parameters follow it. */\nconst FLIGHT_CONTENT_TYPE = 'text/x-component';\n\n/**\n * Fetches a payload, refusing a response that is not one.\n *\n * The status cannot be the gate: a payload legitimately arrives as a 404 from the `notFound` page and as a\n * 500 from an action that threw, and both carry a real payload the caller has to see. The content type is.\n *\n * What this catches is the response that is not a payload at all — a `bodyLimit()` 413, a proxy's error page,\n * a 502 mid-deploy. Handed to the flight parser those all surface as `Error: Connection closed.`, with the\n * status and the body nowhere in sight; here they become an error that says what arrived.\n */\nasync function payloadResponse(request: Request): Promise<Response> {\n const response = await fetch(request);\n const contentType = response.headers.get('content-type');\n if (contentType?.startsWith(FLIGHT_CONTENT_TYPE)) return response;\n // Read for the message: a plain-text refusal says what it refused only in its body, and HTTP/2 has no\n // `statusText` at all. Bounded, because this is an error path and the body is not ours to trust.\n const body = await response.text().then(\n (text) => text.trim().slice(0, 200),\n () => '',\n );\n const status = `${response.status}${response.statusText ? ` ${response.statusText}` : ''}`;\n throw new Error(`[rshono] the server answered ${status} (${contentType ?? 'no content type'}) instead of a payload${body ? `: ${body}` : ''}`);\n}\n\n/**\n * A payload fetch, split into what React parses and a signal for the end of the stream.\n *\n * The payload promise resolves as soon as the root model is ready, which for a streamed response is well\n * before the response body has delivered its last chunk. {@link loadPayload} needs the second promise to\n * recover a transition React can leave suspended when a later chunk resolves — see the retry there.\n */\ntype FetchedPayload = { payload: Promise<RscPayload>; settled: Promise<void> };\n\n/**\n * Asks a URL for its flight payload. Deliberately uncached — a payload can never be staler than the click\n * that wanted it, and the browser's own HTTP cache is what makes a repeat visit cheap.\n *\n * The body rides through a pass-through so its end is observable: a tee would keep a copy of every byte\n * React has not parsed yet, and the flight stream is the one thing here that can be large.\n */\nfunction requestPayload(href: string, signal?: AbortSignal): FetchedPayload {\n const response = payloadResponse(createRscRequest(new URL(href, location.href).href, undefined, signal));\n const { promise: settled, resolve: settle } = Promise.withResolvers<void>();\n const forFlight = response.then((value) => {\n const body = value.body;\n if (!body) {\n settle();\n return value;\n }\n const stream = body.pipeThrough(new TransformStream<Uint8Array, Uint8Array>({ flush: () => settle() }));\n return new Response(stream, { status: value.status, statusText: value.statusText, headers: value.headers });\n });\n return { payload: createFromFetch<RscPayload>(forFlight), settled };\n}\n\n/**\n * Whether the browser hands us its navigations. Gated on `sourceElement` rather than on `navigation` itself:\n * Chrome shipped the event in 102 and that property only in 135, and without it a `data-native` link cannot\n * be told from any other — so the older window would soft-navigate the very links that asked not to be.\n *\n * Where this is false there is no interception at all and every navigation is a real browser load, which a\n * server-rendered app answers correctly on its own. Only the soft part is missing.\n *\n * Both globals are tested, and neither is touched before: this runs at module scope, where a ReferenceError\n * would take the whole client runtime down with it rather than degrading anything.\n */\nconst canSoftNavigate = typeof navigation !== 'undefined' && typeof NavigateEvent !== 'undefined' && 'sourceElement' in NavigateEvent.prototype;\n\n/**\n * The runtime owns a soft navigation's scroll, so the browser's own restoration has to be off: left on, a\n * traversal restores the destination's offset against the outgoing tree before the payload for that entry\n * has even been asked for, and the incoming tree overwrites it. `manual` only concerns the entries this\n * document creates — a navigation to another document creates its own entry `auto` — and it also turns the\n * browser's reload restoration off, which {@link readStoredScrollPositions} and the first layout effect put\n * back.\n *\n * Gated on the soft router: below the Navigation API floor every navigation is a real document load, which\n * a server-rendered app answers correctly and the browser restores correctly, and taking that over without\n * a router to repaint the entry would strand the visitor at the top.\n */\nif (canSoftNavigate) {\n try {\n history.scrollRestoration = 'manual';\n } catch {\n // A preference, not a requirement: where it cannot be set, the browser's restoration and the runtime's\n // own can race on a traversal, and the runtime's runs at commit, after.\n }\n}\n\n/** A scroll offset, in the coordinates `window.scrollTo` takes and `window.scrollX`/`window.scrollY` return. */\ntype ScrollPoint = { x: number; y: number };\n\n/**\n * Where each history entry of this document was left, keyed by its Navigation API key. In memory for the\n * document's life; {@link persistScrollPositions} also writes it to `sessionStorage` so a reload — which\n * the `manual` mode above stops the browser restoring — lands where the last document was left.\n */\nconst scrollPositions = new Map<string, ScrollPoint>();\n\n/** The `sessionStorage` key holding {@link scrollPositions}. */\nconst SCROLL_STORAGE_KEY = 'rshono:scroll';\n\n/** How many entries are kept in that snapshot; the oldest falls out first — `Map` iteration order. */\nconst SCROLL_STORAGE_LIMIT = 50;\n\n/** The key of the history entry being shown, or `undefined` where the soft router does not exist. */\nfunction currentEntryKey(): string | undefined {\n return canSoftNavigate ? navigation.currentEntry?.key : undefined;\n}\n\n/**\n * Records where the outgoing entry is being left. Read at `navigate` time — before the browser commits the\n * new entry — and at `pagehide`, so whatever the navigation turns out to be, the entry it leaves has a\n * position to come back to.\n */\nfunction rememberCurrentScroll(): void {\n const key = currentEntryKey();\n if (key) scrollPositions.set(key, { x: window.scrollX, y: window.scrollY });\n}\n\n/** The position `key` was left at, or `undefined` when this document never saw it. */\nfunction scrollPointFor(key: string | undefined): ScrollPoint | undefined {\n return key === undefined ? undefined : scrollPositions.get(key);\n}\n\n/**\n * Reads the last document's snapshot back into {@link scrollPositions}. Called once, on startup, before the\n * first payload commits: the in-memory map alone would lose every entry the moment the document is replaced.\n */\nfunction readStoredScrollPositions(): void {\n try {\n const raw = sessionStorage.getItem(SCROLL_STORAGE_KEY);\n if (!raw) return;\n for (const [key, point] of Object.entries(JSON.parse(raw) as Record<string, ScrollPoint>)) {\n if (Number.isFinite(point?.x) && Number.isFinite(point?.y)) scrollPositions.set(key, point);\n }\n } catch {\n // Blocked site data, or a snapshot written by a different version. Either way there is nothing to restore,\n // and the page is still correct without it.\n }\n}\n\n/** Writes {@link scrollPositions} out, oldest first, bounded — see {@link SCROLL_STORAGE_LIMIT}. */\nfunction persistScrollPositions(): void {\n try {\n while (scrollPositions.size > SCROLL_STORAGE_LIMIT) {\n const oldest = scrollPositions.keys().next().value;\n if (oldest === undefined) break;\n scrollPositions.delete(oldest);\n }\n sessionStorage.setItem(SCROLL_STORAGE_KEY, JSON.stringify(Object.fromEntries(scrollPositions)));\n } catch {\n // Blocked site data: the in-memory map still carries this document's navigations.\n }\n}\n\n/**\n * The snapshot starts with the document, not with hydration: the page is visible and clickable while the\n * initial payload streams, and a reload or a navigation away in that window would otherwise lose the offset\n * now that `manual` has stopped the browser restoring it. Nothing here depends on the router being mounted,\n * so it does not wait for {@link listenNavigation}.\n */\nif (canSoftNavigate) {\n window.addEventListener('pagehide', () => {\n rememberCurrentScroll();\n persistScrollPositions();\n });\n}\n\n/**\n * Drops a navigation's result promises. Both reject when a navigation is superseded or cancelled — routine\n * here, since a second click is meant to abandon the first — and unhandled they would be reported as faults.\n */\nfunction settle(result: NavigationResult): void {\n const ignore = () => {};\n void result.committed?.catch(ignore);\n void result.finished?.catch(ignore);\n}\n\n/**\n * The mark {@link loadDocument} puts on its navigations, so the `navigate` listener below recognizes them as\n * the runtime's own. A symbol because the identity has to survive the trip through the browser intact:\n * `NavigateEvent.info` hands the value back by reference, so only the navigation that was given it matches.\n */\nconst documentNavigation = Symbol('rshono:document-navigation');\n\n/**\n * Performs a navigation the router below must **not** intercept, and returns having asked for it.\n *\n * `listenNavigation` intercepts a `reload` on purpose — that is what `router.refresh()` is — and every caller\n * here is reaching for a *new document* precisely because the current one cannot be repaired: the React root\n * a soft load would render into is the thing that just failed, or is about to be torn down. Intercepted, the\n * escape hatch becomes a payload fetch that lands nowhere — which is how a late `notFound()` left the tab on\n * its Suspense fallback with no second document ever arriving, and how a late `redirect()` moved the address\n * bar to a page it then failed to render.\n *\n * The mark rides the navigation itself, through `info`, so the listener recognizes the event that owns it\n * instead of consuming a flag set in advance. There is no state to clear and none to leak: a navigation the\n * browser refuses cannot make the next one a full load. Below the Navigation API there is no interception to\n * opt out of, and `location.*` is already a document load.\n */\nfunction loadDocument(href?: string): void {\n if (!canSoftNavigate) {\n if (href === undefined) window.location.reload();\n else window.location.assign(href);\n return;\n }\n\n settle(href === undefined ? navigation.reload({ info: documentNavigation }) : navigation.navigate(href, { info: documentNavigation }));\n}\n\n// The imperative actions behind `useNavigation().router`. Each one only *asks*: the browser turns it into a\n// `navigate` event, which is where `listenNavigation` answers it — so a `router.push` and a link click reach\n// the same code by the same route, and inherit the same fetch, scroll and `pending` flag.\nfunction push(href: string): void {\n if (canSoftNavigate) settle(navigation.navigate(href, { history: 'push' }));\n else window.location.assign(href);\n}\n\nfunction replace(href: string): void {\n if (canSoftNavigate) settle(navigation.navigate(href, { history: 'replace' }));\n else window.location.replace(href);\n}\n\n// A traversal is the browser's to perform either way — `navigation` only hands it back as an interceptable\n// event first. Nothing to go back to is a rejection there and a no-op here; both amount to the same thing.\nfunction back(): void {\n if (canSoftNavigate) settle(navigation.back());\n else window.history.back();\n}\n\nfunction forward(): void {\n if (canSoftNavigate) settle(navigation.forward());\n else window.history.forward();\n}\n\n// A refresh keeps the URL, and is still a navigation: it arrives as `navigationType: 'reload'`, which is what\n// tells the listener to leave scroll and focus where the user left them.\nfunction refresh(): void {\n if (canSoftNavigate) settle(navigation.reload());\n else window.location.reload();\n}\n\n/** How long the recovery reload is given to replace this document before the panel is painted instead. */\nconst RELOAD_GRACE_MS = 2000;\n\n/** The `sessionStorage` key bounding the recovery reload for one URL. Spent here, released in {@link main}. */\nconst lateNotFoundKey = (): string => `rshono:late-not-found:${documentUrl()}`;\n\n/**\n * Spends the one reload a late `notFound()` gets, or paints if it has already been spent for this URL.\n *\n * `redirect()` is terminal on the client — there is somewhere to navigate to — and `notFound()` is not: the\n * response is already committed as a 200, so the only recovery left is asking for the page again and hoping\n * the signal comes early enough this time to be a real 404. That works where the lateness was incidental, a\n * boundary that happened to resolve after the shell on a slow request. Where it is structural — a page that\n * always signals from a late boundary — the reload gets a byte-identical response and reloads again, and the\n * tab spins until the visitor leaves. In production nothing is logged, because the warning that explains this\n * is `isDev`-only.\n *\n * So it is bounded: one reload per URL per tab, then {@link showLateNotFound}. `sessionStorage` because the\n * value has to outlive the document it is written in and must not outlive the tab, and keyed by URL so a\n * second page's late signal still gets its own attempt.\n */\nfunction reloadOnceForLateNotFound(): void {\n const key = lateNotFoundKey();\n let spent: boolean;\n try {\n spent = sessionStorage.getItem(key) !== null;\n if (!spent) sessionStorage.setItem(key, '1');\n } catch {\n // Storage can throw outright where site data is blocked, and a page that cannot count its reloads has\n // to pick a side. It picks the terminating one: a message on a page that might have recovered is a\n // worse outcome than a reload loop only by a lot less.\n spent = true;\n }\n if (spent) {\n showLateNotFound();\n return;\n }\n\n loadDocument();\n\n // The reload wins this race whenever it happens at all: the document goes away and takes the timer with\n // it. What this covers is a reload that does not happen — swallowed by an interceptor, refused by the\n // browser, held by a `beforeunload` — which used to leave the visitor on a Suspense fallback with nothing\n // coming and nothing said. The panel is the honest answer in that case too.\n setTimeout(() => {\n if (!document.querySelector('[data-rshono-fatal]')) showLateNotFound();\n }, RELOAD_GRACE_MS);\n}\n\n/**\n * Turns a control-signal digest — how `redirect()` / `notFound()` reach the browser — into a real\n * navigation. Returns false for anything else, so callers fall through to their own handling.\n *\n * `hard` forces a full document load, for signals that surfaced *through React*: it unmounts the root on\n * an uncaught error, leaving no live tree to soft-navigate with.\n */\nfunction handleControlDigest(error: unknown, { hard = false }: { hard?: boolean } = {}): boolean {\n const digest = (error as { digest?: unknown } | null)?.digest;\n if (!isControlDigest(digest)) return false;\n const redirect = parseRedirectDigest(digest);\n if (!redirect) {\n reloadOnceForLateNotFound();\n } else if (hard) {\n // The URL is resolved first: a malformed location then throws here, before any navigation is asked for.\n loadDocument(new URL(redirect.location, window.location.href).href);\n } else {\n push(redirect.location);\n }\n return true;\n}\n\n/**\n * Scrolls the document to its start.\n *\n * The options form rather than `scrollTo(0, 0)`: the two-argument call is `auto`, which follows a\n * `scroll-behavior` the app may have set on `html`, and a soft navigation that animates its own reset reads\n * as a glitch rather than a page change.\n */\nfunction scrollToTop(): void {\n window.scrollTo({ top: 0, left: 0, behavior: 'instant' });\n}\n\n/** Puts a saved offset back. Instant for the same reason {@link scrollToTop} passes it. */\nfunction scrollToPoint(point: ScrollPoint): void {\n window.scrollTo({ top: point.y, left: point.x, behavior: 'instant' });\n}\n\n/**\n * Scrolls to a fragment's target the way the browser's own fragment jump does.\n *\n * `scrollIntoView` is the algorithm that honours `scroll-padding-top` on the scrolling box and\n * `scroll-margin-top` on the target, which `window.scrollTo` does not. The lookup follows the browser's\n * \"find a potential indicated element\": the id first, then the name. A malformed percent-escape falls back\n * to the literal fragment, and a fragment nothing matches gets the top of the document — what a browser\n * gives a missing anchor on a real load.\n */\nfunction jumpToAnchor(hash: string): void {\n const raw = hash.startsWith('#') ? hash.slice(1) : hash;\n // No special case for `#top`: the browser only treats it as the top of the document when no element\n // matches, and the fallback below is that top.\n if (raw === '') {\n scrollToTop();\n return;\n }\n let id = raw;\n try {\n id = decodeURIComponent(raw);\n } catch {\n // Malformed escape — the literal fragment is the better guess at the id than nothing.\n }\n const target = document.getElementById(id) ?? document.getElementsByName(id)[0];\n if (target) target.scrollIntoView();\n else scrollToTop();\n}\n\n/**\n * Moves focus the way the browser's `focusReset: 'after-transition'` does: the first `autofocus` element,\n * else the document body. A traversal is no longer intercepted, so the browser performs no focus reset for\n * it; without this, Back would leave focus on the link that was clicked on the page being left, and the next\n * Tab would resume there. `preventScroll` because the traversal's own offset has just been restored.\n */\nfunction resetFocus(): void {\n const autofocus = document.querySelector<HTMLElement>('[autofocus]');\n if (autofocus) autofocus.focus({ preventScroll: true });\n else document.body.focus({ preventScroll: true });\n}\n\n/**\n * Puts a payload on screen, resolving once React has committed it. Replaced by `BrowserRoot`'s own on mount;\n * the default covers the window before hydration, where `setServerCallback` is already registered but there\n * is no root to update — a reload is the honest answer, and nothing after it needs to run.\n *\n * `afterCommit`, when given, runs in the same layout effect that releases the commit: after the new tree is\n * in the DOM and before the browser paints, which is the only moment a `#hash` target exists and the\n * pre-scroll position has not been shown.\n */\nlet setPayload: (payload: RscPayload, afterCommit?: () => void) => Promise<void> = () => {\n window.location.reload();\n return new Promise<void>(() => {});\n};\n\n/**\n * Re-dispatches the payload already waiting to commit, for {@link loadPayload}'s lost-ping retry. Unlike\n * {@link setPayload} it creates and releases no commit promise, so re-rendering the same payload cannot\n * resolve the navigation's commit early. Assigned with {@link setPayload} by `BrowserRoot`.\n */\nlet reapplyPayload: () => void = () => {};\n\n/** Runs work inside the nav transition so `useNavigation().pending` stays true across the round-trip. */\nlet startNav: (run: () => void | Promise<void>) => void = (run) => {\n void run();\n};\n\n/**\n * The navigation whose payload is allowed to settle the screen. React runs async work concurrently, so two\n * navigations are two live fetches with no ordering between them; without this a slow first response landing\n * after a fast second one repaints the page the user already left. The Navigation API aborts an intercepted\n * navigation when a newer one starts, but a traversal has no `event.signal` to watch — `popstate` arrives\n * after the browser has already committed it — so ordering is the runtime's own for those.\n */\nlet currentNavigation = 0;\n\n/** The in-flight navigation's fetch, so a newer one can stop paying for it. */\nlet navigationFetch: AbortController | null = null;\n\n/**\n * Fetches the payload for `url` and puts it on screen.\n *\n * Resolves once React has **committed** it rather than when the fetch lands: `afterCommit` runs at that\n * point, and a `#hash` target does not exist until the new tree does. Rejects only on a genuine failure —\n * being superseded is not one, and resolves quietly, because the navigation that replaced this one owns the\n * screen from then on.\n */\nfunction loadPayload(url: string, signal?: AbortSignal, afterCommit?: () => void): Promise<void> {\n // This navigation's place in the queue, and its own abort switch: a fetch is abandoned by whichever comes\n // first, the browser superseding it (an intercepted navigation carries `event.signal`) or a newer runtime\n // fetch starting (a traversal, an action, a dev refresh).\n const navigation = ++currentNavigation;\n navigationFetch?.abort();\n const controller = (navigationFetch = new AbortController());\n const abort = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;\n\n // Deliberately not awaited inside the transition: the scope ends once the payload is handed to React, and\n // React holds `pending` until the update it scheduled commits. Awaiting the commit *inside* the scope would\n // work too, but only because React happens not to gate a commit on its async scope settling — an internal\n // this has no reason to depend on across the whole `^19.1.0` peer range.\n let committed: Promise<void> | undefined;\n // Whether the payload update has committed. A streamed transition can suspend on a flight chunk whose later\n // resolution React never pings the lane back for; the retry below re-schedules the update once the stream\n // has closed, but only while this is still false.\n let committedSettled = false;\n\n const run = async () => {\n const { payload, settled } = requestPayload(url, abort);\n const nextPayload = await payload;\n // Checked again after the await because the fetch may already have resolved by then, and applying it\n // would repaint a page the user has left.\n if (abort.aborted || navigation !== currentNavigation) return;\n if (nextPayload.redirect) {\n push(nextPayload.redirect);\n return;\n }\n // The fetch crossed an await, so its payload update needs a new synchronous transition scope.\n // Keep the commit promise outside the async Action; React tracks the scheduled update until commit.\n React.startTransition(() => {\n committed = setPayload(nextPayload, afterCommit);\n void committed.then(() => (committedSettled = true));\n });\n\n // A streamed payload can suspend a transition on a flight chunk that resolves after the shell without\n // React ever pinging the suspended lane back, which strands the navigation on the previous tree. The\n // chunks have all landed by the time the stream closes, so one re-application — still a transition, so a\n // payload that is waiting on something other than flight keeps the #52 behaviour — commits the render a\n // lost ping stranded. It goes through `reapplyPayload` rather than `setPayload`: the payload is not\n // replaced, so the commit the navigation waits on has to stay attached to it. The macrotask lets the\n // decoder process the last chunk and React's own retry run first, so the normal path is not interrupted.\n void settled.then(() => {\n if (abort.aborted || navigation !== currentNavigation || committedSettled) return;\n setTimeout(() => {\n if (abort.aborted || navigation !== currentNavigation || committedSettled) return;\n React.startTransition(reapplyPayload);\n }, 0);\n });\n };\n\n // `startTransition` runs the work but hands nothing back, so the promise carrying a failure is caught here\n // instead. Assigned synchronously: React invokes the callback before `startNav` returns.\n let work!: Promise<void>;\n startNav(() => (work = run()));\n\n return work.then(\n // Undefined whenever nothing was applied — an abort, or a redirect — and there is then nothing to wait for.\n () => committed,\n (error: unknown) => {\n // Checked before the error is read: an abort is this navigation being replaced, and the one that\n // replaced it owns the outcome.\n if (abort.aborted || navigation !== currentNavigation || handleControlDigest(error)) return;\n throw error;\n },\n );\n}\n\n/**\n * Whether a destination names a file rather than a page. `public/`, `/_static` and an endpoint route that\n * serves a document (`/llms.txt`, `/sitemap.xml`) answer an RSC fetch with the file itself, not a flight\n * payload — so intercepting one buys nothing: the payload never arrives, and the only recovery left is the\n * document load the browser would have made directly. Handing it that navigation up front also gives the\n * entry the file loads into the browser's own history, so Back is an ordinary cross-document traversal. An\n * intercepted entry is same-document by construction, and traversing one with nothing to repaint it changes\n * the URL and nothing else — which is what a Back press out of an opened file was doing.\n *\n * A dot in the last path segment rather than a list of extensions: a list is never complete, and every miss\n * is the failed round trip above. A page route whose last segment carries a dot (`/release-1.0`) therefore\n * costs a document load — the direction to err in, and what a `data-native` link already asks for by hand.\n */\nfunction namesAFile(href: string): boolean {\n const lastSegment = new URL(href).pathname.split('/').pop() ?? '';\n return lastSegment.includes('.');\n}\n\n/**\n * Navigations the browser can hand over but shouldn't:\n *\n * - a fragment jump, which is same-document already and needs no payload — the browser's own jump is the one\n * that honours `scroll-padding-top`, and re-rendering would pull the target out from under it;\n * - a download, which is not a navigation of this page at all;\n * - a `POST` form, which is a submission and the server's to answer (a `GET` form carries its fields in the\n * URL, has no `formData`, and soft-navigates like any other link);\n * - a link marked `data-native`, the documented opt-out;\n * - a destination that names a file — see {@link namesAFile}.\n */\nfunction leaveToBrowser(event: NavigateEvent): boolean {\n return (\n event.hashChange ||\n event.downloadRequest !== null ||\n event.formData !== null ||\n event.sourceElement?.hasAttribute('data-native') === true ||\n namesAFile(event.destination.url)\n );\n}\n\n/**\n * The whole router, in one listener.\n *\n * Every navigation the page can make arrives as a `navigate` event — a link click, a `GET` form, a\n * `history.pushState`, the back button, `navigation.reload()` — already filtered by the browser: it does not\n * fire for a middle-click, a modified click or a new tab, and reports `canIntercept: false` for anything\n * cross-origin, or for a traversal that leaves the app. Those need no handling here; they are left alone, and\n * the browser performs them as it always would.\n */\nfunction listenNavigation(): () => void {\n if (!canSoftNavigate) return () => {};\n\n const onNavigate = (event: NavigateEvent) => {\n // A document navigation the runtime asked for itself, marked through `info`. Checked before the scroll\n // snapshot: the document is going away, so where its entry was left does not matter, and an unrelated\n // later navigation can never be mistaken for this one.\n if (event.info === documentNavigation) return;\n\n // Whatever the browser is about to do with this navigation, the entry it is leaving is about to lose the\n // offset it was at, and nothing else in this document will put it back. Saved before the branches below\n // return, so a fragment the browser performs itself is covered too.\n rememberCurrentScroll();\n\n if (!event.canIntercept || leaveToBrowser(event)) return;\n\n // A traversal is repainted by the `popstate` listener below, not intercepted. `intercept`ing one is what\n // makes WebKit stall the rendered viewport for about three seconds on a back swipe\n // (bugs.webkit.org/319414): the view gesture's snapshot is only removed once the navigation finishes, and\n // React's root attaches the wheel listener the bug also needs. Letting the traversal through means the\n // browser commits the entry straight away, and the runtime puts the payload on screen when it arrives.\n if (event.navigationType === 'traverse') return;\n\n // A replace or a refresh stays where it is, so neither should move. A push starts at the top of the\n // page, or at its fragment — and that scroll is the runtime's own now: WebKit performs no\n // `after-transition` reset at all for an intercepted push (bugs.webkit.org/304593). Chromium skips it\n // too, and a fragment jump rides the same code path. Passing `manual` here makes the browser hand the\n // handler over without scrolling; the `afterCommit` callback reaches the target once the new tree is on\n // screen. Focus stays the browser's, reset after the transition.\n const inPlace = event.navigationType === 'replace' || event.navigationType === 'reload';\n let afterCommit: (() => void) | undefined;\n if (event.navigationType === 'push') {\n const { hash } = new URL(event.destination.url);\n afterCommit = hash === '' ? scrollToTop : () => jumpToAnchor(hash);\n }\n\n event.intercept({\n scroll: 'manual',\n focusReset: inPlace ? 'manual' : 'after-transition',\n // The URL commits before the handler runs, so a failure leaves the address bar describing a page the\n // document is not showing. A real load is the only way back to agreement.\n handler: () => loadPayload(event.destination.url, event.signal, afterCommit).catch(() => loadDocument()),\n });\n };\n\n /**\n * Repaints a traversal the listener above deliberately left to the browser, and moves the viewport back\n * where the entry was left. `popstate` fires after the browser has committed the entry, so the destination\n * is `navigation.currentEntry` and its saved offset is in {@link scrollPositions}.\n */\n const onPopState = () => {\n const stored = scrollPointFor(currentEntryKey());\n const hash = location.hash;\n const apply = () => {\n if (stored) scrollToPoint(stored);\n else if (hash !== '') jumpToAnchor(hash);\n else scrollToTop();\n };\n\n // A fragment-only traversal never changed the payload: the address bar is back at an anchor of the page\n // already on screen, so there is nothing to fetch and nothing to wait for. The browser's own restoration\n // is off, so the offset comes from what `onNavigate` saved when the anchor was followed; no focus reset,\n // which is what leaving those navigations to the browser has always meant.\n if (documentUrl() === renderedUrl) {\n apply();\n return;\n }\n\n void loadPayload(location.href, undefined, () => {\n apply();\n // The browser performs this for an intercepted navigation; a traversal is no longer intercepted, so\n // without it Back would leave focus on the link that was clicked on the page being left.\n resetFocus();\n }).catch(() => loadDocument());\n };\n\n navigation.addEventListener('navigate', onNavigate);\n window.addEventListener('popstate', onPopState);\n return () => {\n navigation.removeEventListener('navigate', onNavigate);\n window.removeEventListener('popstate', onPopState);\n };\n}\n\nasync function main() {\n // The assertion is load-bearing under the compiler that builds this: TypeScript 7 declares `nonce` on\n // HTMLElement, 6 declares it on Element. ESLint runs the older lib — where the narrowing is redundant —\n // so it reports an assertion that `tsc` requires. Believe `typecheck`, not the rule.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const cspMeta = document.querySelector('meta[property=\"csp-nonce\"]') as HTMLMetaElement | null;\n if (cspMeta?.nonce) __webpack_nonce__ = cspMeta.nonce;\n\n const initialPayload = await createFromReadableStream<RscPayload>(flightStream);\n\n // The recovery reload landed: this document *is* the `notFound` page, so the signal that could only be a\n // digest on the `RSC: 1` request became a real 404 on the document request. The one-reload bound was spent\n // on a recovery that worked and has to be released — otherwise the *next* soft navigation to this URL sees a\n // spent key and paints {@link showLateNotFound} over a page the app can still render.\n //\n // This is the discriminator the bound was missing. A structurally late `notFound()` commits its 200 before\n // it signals, so its reloaded document is the page itself and carries no `notFound`: the key survives and\n // that loop stays bounded at one reload, which is the whole reason the bound exists.\n if (initialPayload.notFound) {\n try {\n sessionStorage.removeItem(lateNotFoundKey());\n } catch {\n // Blocked site data. `reloadOnceForLateNotFound` already treats that as the terminating case.\n }\n }\n\n // Everything the last document saved, read before any payload commits: the in-memory map alone would not\n // survive the reload that `history.scrollRestoration = 'manual'` just stopped the browser restoring. The\n // entry's key is stable across a reload, and the offset is applied by `BrowserRoot`'s first layout effect,\n // before the first paint of the new tree.\n if (canSoftNavigate) readStoredScrollPositions();\n const restored = scrollPointFor(currentEntryKey());\n\n function BrowserRoot() {\n const [payload, setPayloadState] = React.useState(initialPayload);\n const [pending, startTransition] = React.useTransition();\n // The payload the last `setPayload` put on screen or on its way there, so `reapplyPayload` re-renders\n // that one rather than a payload a later navigation or action has already replaced.\n const currentPayload = React.useRef<RscPayload>(initialPayload);\n // The resolver the payload on screen still owes — see {@link loadPayload}.\n const pendingCommit = React.useRef<(() => void) | null>(null);\n // The scroll the payload about to commit owes, set with it so a payload that supersedes another takes\n // its predecessor's scroll out of the queue along with its commit. Initialised with the reload's offset:\n // the first layout effect below applies it with the first payload, before the new tree is painted.\n const pendingScroll = React.useRef<(() => void) | null>(restored ? () => scrollToPoint(restored) : null);\n\n // Descendant passive effects can start a navigation before the root's passive effects run.\n // Install the live payload setter and transition runner before any such navigation starts.\n React.useLayoutEffect(() => {\n setPayload = (next, afterCommit) => {\n currentPayload.current = next;\n return new Promise<void>((resolve) => {\n // A payload replaced before it ever painted still has a navigation waiting on it. React commits\n // only the newest, so the effect below never runs for the one it skipped: release it here.\n pendingCommit.current?.();\n pendingCommit.current = resolve;\n // Replaced rather than kept: a server action's payload carries no `afterCommit`, and the\n // navigation it superseded must not scroll the page the action is about to replace it with.\n pendingScroll.current = afterCommit ?? null;\n setPayloadState(next);\n });\n };\n // A re-dispatch of the payload above, for the retry in `loadPayload`: keeping `pendingCommit` and\n // `pendingScroll` in place means the navigation already waiting resolves when this render commits,\n // not when the retry runs.\n reapplyPayload = () => setPayloadState(currentPayload.current);\n startNav = (run) => startTransition(run);\n }, [startTransition]);\n\n /**\n * Performs the pending scroll and releases the navigation waiting on this payload. A layout effect, so\n * the new tree is in the DOM and the pre-scroll position is never painted.\n */\n React.useLayoutEffect(() => {\n const scroll = pendingScroll.current;\n pendingScroll.current = null;\n scroll?.();\n // What the payload that just committed was rendered for — see {@link renderedUrl}. A redirect never\n // reaches here, and an action or a dev refresh keeps the URL it was fetched for.\n renderedUrl = documentUrl();\n const commit = pendingCommit.current;\n pendingCommit.current = null;\n commit?.();\n }, [payload]);\n\n // A descendant may navigate from its first passive effect. Intercept it before that effect runs.\n React.useLayoutEffect(() => listenNavigation(), []);\n\n const router = React.useMemo<NavigationRouter>(() => ({ push, replace, back, forward, refresh, pending }), [pending]);\n\n return <RouterContext.Provider value={router}>{payload.root}</RouterContext.Provider>;\n }\n\n setServerCallback(async (id, args) => {\n const temporaryReferences = createTemporaryReferenceSet();\n // The document the action is being called from. Every action response carries a fresh payload for that\n // page, so if a navigation has moved on by the time it arrives the payload describes a page the user has\n // left — the return value is still theirs, but painting it is not. Compared without the fragment, which\n // the server never saw.\n const calledFrom = documentUrl();\n const request = createRscRequest(window.location.href, {\n id,\n body: await encodeReply(args, { temporaryReferences }),\n });\n let payload: RscPayload;\n try {\n payload = await createFromFetch<RscPayload>(payloadResponse(request), { temporaryReferences });\n } catch (error) {\n if (handleControlDigest(error)) return undefined;\n throw error;\n }\n if (payload.redirect) {\n push(payload.redirect);\n return undefined;\n }\n if (documentUrl() === calledFrom) React.startTransition(() => void setPayload(payload));\n if (payload.notFound) return undefined;\n const result = payload.returnValue;\n if (!result) {\n // A payload that is not this action's own reply: the server rendered a page in its place. An action\n // that had already run has its result carried across (see `actionResults` in entry.rsc.tsx), and the\n // ways a *caller* can get a request wrong are refused ahead of any render — an unknown id or an\n // undecodable body is a `text/plain` 400, which `payloadResponse` turns into an error of its own\n // before this.\n //\n // What is left is the server failing before the action ran, which is answered with the `error` page —\n // a flight payload, so it arrives here rather than at `payloadResponse`, with no `returnValue` in it.\n // A module the deployment no longer holds is the reachable case: `loadServerAction` throws, the\n // framework reports it and 500s, and this is what the caller has to go on. Hence the message: the\n // failure is on the server and its log is where the error is. Below that it is still the defensive\n // floor for a payload shaped by another deployment or replaced by a proxy — reading `.ok` off it used\n // to hand the caller `Cannot read properties of undefined`.\n throw new Error(\n '[rshono] the server action produced no result — the request failed around it and the server answered with a page instead. Its log has the error.',\n );\n }\n if (!result.ok) throw result.error;\n return result.value;\n });\n\n // A `redirect()` / `notFound()` from a component below the page root reaches us through React: it rides the\n // flight payload as an error, and boundaries re-throw it so it lands here rather than in a fallback.\n //\n // Installing these hooks opts out of React's own defaults, so everything that isn't a control signal has to\n // be put back by hand — `reportError` rather than a bare log, so error-reporting tools still see it.\n hydrateRoot(document, <BrowserRoot />, {\n formState: initialPayload.formState,\n onCaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true })) return;\n // A boundary handled it and the tree is intact, so no overlay over the app's own fallback.\n console.error(error, errorInfo.componentStack ?? '');\n },\n onUncaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true })) return;\n // Nothing caught it, so React tears the root down — and the root is `document`.\n globalThis.reportError(error);\n showFatal(error, errorInfo.componentStack);\n },\n });\n\n if (import.meta.webpackHot) {\n initDevRefresh();\n }\n}\n\n/**\n * Dev-only refresh client, listening to the CLI's SSE endpoint:\n *\n * client-built → hot-apply the waiting updates; anything the page can't be patched up to reloads.\n * rsc-update → server component code changed: re-fetch the flight payload, state preserved.\n * hello → sent on (re)connect with the latest build hash; a mismatch means a missed event.\n */\nfunction initDevRefresh() {\n const hot = import.meta.webpackHot!;\n let connectedOnce = false;\n /** The newest build the dev server has announced — what {@link applyClientUpdate} walks towards. */\n let targetHash: string | undefined;\n\n function reload(reason: string, error?: unknown): void {\n console.warn(`[rshono] ${reason} — reloading`, ...(error === undefined ? [] : [error]));\n loadDocument();\n }\n\n async function applyClientUpdate(): Promise<void> {\n const giveUp = await walkHotUpdates(\n hot,\n () => __webpack_hash__,\n () => targetHash,\n );\n if (giveUp) reload(giveUp.reason, giveUp.error);\n }\n\n async function handle(message: DevMessage): Promise<void> {\n switch (message.type) {\n case 'hello':\n targetHash = message.hash ?? targetHash;\n if (connectedOnce) {\n await applyClientUpdate();\n await loadPayload(window.location.href).catch(() => loadDocument());\n }\n connectedOnce = true;\n break;\n case 'client-built':\n targetHash = message.hash;\n await applyClientUpdate();\n break;\n case 'rsc-update':\n console.log('[rshono] server components updated');\n await loadPayload(window.location.href).catch(() => loadDocument());\n break;\n }\n }\n\n const source = new EventSource('/_rshono/hmr');\n // Chained rather than handled as they arrive: `hot.check` may only run from `idle`, and a burst of saves\n // puts several frames on the wire inside the time one takes. Queueing drops nothing, because `targetHash`\n // is shared — whichever handler runs next walks to the newest build.\n let queue: Promise<void> = Promise.resolve();\n source.onmessage = (event: MessageEvent<string>) => {\n const message = JSON.parse(event.data) as DevMessage;\n queue = queue.then(() => handle(message)).catch((error) => reload('the dev client failed', error));\n };\n}\n\n// A bootstrap failure — a truncated initial payload, most likely — would otherwise be an unhandled\n// rejection: nothing hydrates, nothing is reported, and the page just sits there.\nmain().catch((error) => {\n console.error('[rshono] the client runtime failed to start:', error);\n showFatal(error);\n});\n"]}
|
|
1
|
+
{"version":3,"file":"entry.client.js","sourceRoot":"","sources":["../../src/runtime/entry.client.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,GAEzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGpE,sGAAsG;AACtG,6CAA6C;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAiD,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAOrD,0G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ACtE,CAAC;gBACD,aAAa,GAAG,IAAI,CAAC;gBACrB,MAAM;YACR,KAAK,cAAc;gBACjB,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;gBAC1B,MAAM,iBAAiB,EAAE,CAAC;gBAC1B,MAAM;YACR,KAAK,YAAY;gBACf,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;gBAClD,MAAM,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;gBACpE,MAAM;QACV,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC;IAC/C,yGAAyG;IACzG,0GAA0G;IAC1G,qEAAqE;IACrE,IAAI,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7C,MAAM,CAAC,SAAS,GAAG,CAAC,KAA2B,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAe,CAAC;QACrD,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;IACrG,CAAC,CAAC;AACJ,CAAC;AAED,mGAAmG;AACnG,kFAAkF;AAClF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACrE,SAAS,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport {\n createFromFetch,\n createFromReadableStream,\n createTemporaryReferenceSet,\n encodeReply,\n setServerCallback,\n} from 'react-server-dom-rspack/client.browser';\nimport {\n cancelNavigationPreparation,\n isPreparedNavigation,\n listenNavigationPreparation,\n useNavigationPreparation,\n type PreparedNavigation,\n} from './navigation-preparation.js';\nimport { isControlDigest, parseRedirectDigest } from './control.js';\nimport type { DevMessage } from './dev-protocol.js';\nimport type { RscPayload } from './entry.rsc.js';\n// Dev-only: its one caller sits behind `import.meta.webpackHot`, which a production build compiles to\n// `false` — so this module is dropped there.\nimport { walkHotUpdates } from './hot-update.js';\nimport { RouterContext, type NavigationRouter, type NavigationOutcome } from './navigation.js';\nimport { createRscRequest } from './request.js';\nimport { startNavigationPayload, useNavigationTransition } from './navigation-transition.js';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\ndeclare global {\n /** The array the payload `<script>` tags `flight-inject.ts` emits push their chunks into. */\n var __FLIGHT_DATA: Array<string | Uint8Array> | undefined;\n}\n\n/** The flight payload the document carried, read back out of `__FLIGHT_DATA` — see `flight-inject.ts`. */\nfunction readFlightPayload(): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n // Assigned synchronously by `start`, which `new ReadableStream` runs before it returns.\n let controller!: ReadableStreamDefaultController<Uint8Array>;\n const stream = new ReadableStream<Uint8Array>({\n start: (c) => void (controller = c),\n });\n const enqueue = (chunk: string | Uint8Array) => controller.enqueue(typeof chunk === 'string' ? encoder.encode(chunk) : chunk);\n\n // Payload scripts interleave with the document: the ones that already ran are in the array, the rest\n // arrive through `push`.\n const data = (self.__FLIGHT_DATA ??= []);\n for (const chunk of data) enqueue(chunk);\n data.push = enqueue as typeof data.push;\n\n // The last payload script lands before parsing finishes, so that is what closes the stream.\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => controller.close(), { once: true });\n } else {\n controller.close();\n }\n return stream;\n}\n\n/** Created at module evaluation, not inside `main()`, so no chunk can be pushed before it is watching. */\nconst flightStream = readFlightPayload();\n\n/**\n * The part of the location a payload is rendered for — the document, without the fragment, which the server\n * never sees. Two URLs that differ only by `#hash` describe the same payload.\n */\nconst documentUrl = (): string => location.pathname + location.search;\n\n/**\n * The document URL the payload on screen was rendered for — see {@link documentUrl}. A fragment-only\n * traversal leaves it unchanged, which is how the `popstate` listener knows there is nothing to fetch.\n * Updated in the layout effect that commits a payload.\n */\nlet renderedUrl = documentUrl();\nlet renderedModel: RscPayload | undefined;\nconst navigationModels = new WeakMap<AbortController, RscPayload>();\n\n/** Guarantees somewhere to attach the fatal overlay: the root container is `document`, so a teardown can take `<body>` with it. */\nfunction overlayHost(): HTMLElement {\n if (!document.documentElement) document.appendChild(document.createElement('html'));\n if (!document.body) document.documentElement.appendChild(document.createElement('body'));\n return document.body;\n}\n\n/**\n * Paints a full-viewport panel over whatever is on screen, and returns the box for the caller to fill.\n *\n * DOM calls rather than React (one caller runs because the renderer just failed), and `textContent` rather\n * than `innerHTML` (an error message is untrusted input). Queued on a macrotask: React's teardown runs after\n * the callback that reaches here returns, and would remove a node appended inline.\n */\nfunction paintOverlay(fill: (box: HTMLElement) => void): void {\n setTimeout(() => {\n const host = overlayHost();\n host.querySelector('[data-rshono-fatal]')?.remove();\n\n const box = document.createElement('div');\n box.setAttribute('data-rshono-fatal', '');\n box.setAttribute('role', 'alert');\n box.style.cssText =\n 'position:fixed;inset:0;z-index:2147483647;overflow:auto;padding:1.5rem;background:#18181b;color:#f4f4f5;' +\n 'font:14px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace;text-align:left';\n\n fill(box);\n host.appendChild(box);\n }, 0);\n}\n\n/** The overlay's heading. */\nfunction overlayTitle(text: string): HTMLElement {\n const title = document.createElement('div');\n title.textContent = text;\n title.style.cssText = 'font-size:1.0625rem;font-weight:700;color:#f87171;margin:0 0 0.75rem';\n return title;\n}\n\n/**\n * Paints the reason for an uncaught render error over the blank page it leaves behind — the full stack in\n * dev, a generic notice and a reload button in production.\n */\nfunction showFatal(error: unknown, componentStack?: string | null): void {\n paintOverlay((box) => {\n box.appendChild(overlayTitle(isDev ? 'Unhandled error' : 'Something went wrong'));\n\n if (isDev) {\n const detail = document.createElement('pre');\n detail.style.cssText = 'margin:0;white-space:pre-wrap;word-break:break-word';\n detail.textContent =\n (error instanceof Error ? (error.stack ?? `${error.name}: ${error.message}`) : String(error)) +\n (componentStack ? `\\n\\nComponent stack:${componentStack}` : '');\n box.appendChild(detail);\n } else {\n const message = document.createElement('p');\n message.textContent = 'This page hit an unexpected error and can’t continue.';\n message.style.cssText = 'margin:0 0 1rem;color:#d4d4d8';\n box.appendChild(message);\n }\n\n const reload = document.createElement('button');\n reload.textContent = 'Reload page';\n reload.style.cssText =\n 'margin-top:1.25rem;padding:0.5rem 1rem;font:inherit;color:#18181b;background:#f4f4f5;border:0;border-radius:4px;cursor:pointer';\n reload.addEventListener('click', () => loadDocument());\n box.appendChild(reload);\n });\n}\n\n/**\n * The end of the line for a `notFound()` that arrived too late to be a 404 and did not survive a reload.\n *\n * No reload button, unlike {@link showFatal}: the reload has already been spent, and the second identical\n * response is what brought us here. \"Page not found\" is what the server was trying to say, so it is what the\n * visitor is told; the reason it could not say it properly is a message for whoever wrote the page, and dev is\n * where they are.\n */\nfunction showLateNotFound(): void {\n paintOverlay((box) => {\n box.appendChild(overlayTitle('Page not found'));\n\n const message = document.createElement('p');\n message.textContent = isDev\n ? 'notFound() was raised from a boundary that resolved after the page shell had been sent, so the response ' +\n 'could not be a 404 — and reloading rendered the same page again. Decide before the render starts ' +\n 'streaming: in Hono middleware, or in the page component body above the boundary.'\n : 'This page is not available.';\n message.style.cssText = 'margin:0;color:#d4d4d8';\n box.appendChild(message);\n });\n}\n/** What every flight response is typed as. The charset and any other parameters follow it. */\nconst FLIGHT_CONTENT_TYPE = 'text/x-component';\n\n/** How much of a body that is not a payload is quoted back in the error. */\nconst REFUSAL_BODY_LIMIT = 200;\n\n/**\n * The first {@link REFUSAL_BODY_LIMIT} characters of a response body, without buffering the rest.\n *\n * `response.text()` reads the whole body first, so a proxy's multi-megabyte error page would be buffered and\n * decoded before the 200 characters that are kept — on a path that exists to say what answered instead of a\n * payload. Reading one chunk at a time and cancelling stops paying for bytes nothing will look at.\n */\nasync function refusalBody(response: Response): Promise<string> {\n if (!response.body) return '';\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let text = '';\n try {\n while (text.length < REFUSAL_BODY_LIMIT) {\n const { done, value } = await reader.read();\n if (done) break;\n // `stream: true` so a multi-byte character split across two reads is not replaced by U+FFFD.\n text += decoder.decode(value, { stream: true });\n }\n // Flush a trailing partial multi-byte sequence, so a body cut mid-character reads as U+FFFD rather than\n // dropping the bytes that were already read.\n text += decoder.decode();\n } catch {\n // A body that failed mid-read says no more than the status already did.\n } finally {\n void reader.cancel().catch(() => {});\n }\n return text.slice(0, REFUSAL_BODY_LIMIT).trim();\n}\n\n/**\n * Fetches a payload, refusing a response that is not one.\n *\n * The status cannot be the gate: a payload legitimately arrives as a 404 from the `notFound` page and as a\n * 500 from an action that threw, and both carry a real payload the caller has to see. The content type is.\n *\n * What this catches is the response that is not a payload at all — a `bodyLimit()` 413, a proxy's error page,\n * a 502 mid-deploy. Handed to the flight parser those all surface as `Error: Connection closed.`, with the\n * status and the body nowhere in sight; here they become an error that says what arrived.\n */\nasync function payloadResponse(request: Request): Promise<Response> {\n const response = await fetch(request);\n const contentType = response.headers.get('content-type');\n if (contentType?.startsWith(FLIGHT_CONTENT_TYPE)) return response;\n // Read for the message: a plain-text refusal says what it refused only in its body, and HTTP/2 has no\n // `statusText` at all. Bounded, because this is an error path and the body is not ours to trust.\n const body = await refusalBody(response);\n const status = `${response.status}${response.statusText ? ` ${response.statusText}` : ''}`;\n throw new Error(`[rshono] the server answered ${status} (${contentType ?? 'no content type'}) instead of a payload${body ? `: ${body}` : ''}`);\n}\n\n/**\n * A payload fetch, split into what React parses and a signal for the end of the stream.\n *\n * The payload promise resolves as soon as the root model is ready, which for a streamed response is well\n * before the response body has delivered its last chunk. {@link loadPayload} needs the second promise to\n * recover a transition React can leave suspended when a later chunk resolves — see the retry there.\n *\n * `settled` means **the body arrived in full**, not \"the body is done\". It resolves from the pass-through's\n * `flush`, which only runs when the source closes cleanly; a body that errors — an abort, a network drop, a\n * truncated stream — errors the destination instead and leaves `settled` pending for the life of the entry.\n * That is deliberate: the retry is exactly what must not run for a failed stream, and nothing needs a\n * \"finished, however it finished\" signal today. A later caller that wants one must not read it into this\n * promise.\n */\ntype FetchedPayload = { payload: Promise<RscPayload>; settled: Promise<void> };\n\n/**\n * Asks a URL for its flight payload. Deliberately uncached — a payload can never be staler than the click\n * that wanted it, and the browser's own HTTP cache is what makes a repeat visit cheap.\n *\n * The body rides through a pass-through so its end is observable: a tee would keep a copy of every byte\n * React has not parsed yet, and the flight stream is the one thing here that can be large.\n */\nfunction requestPayload(href: string, signal?: AbortSignal): FetchedPayload {\n const response = payloadResponse(createRscRequest(new URL(href, location.href).href, undefined, signal));\n const { promise: settled, resolve: settle } = Promise.withResolvers<void>();\n const forFlight = response.then((value) => {\n const body = value.body;\n if (!body) {\n settle();\n return value;\n }\n const stream = body.pipeThrough(new TransformStream<Uint8Array, Uint8Array>({ flush: () => settle() }));\n return new Response(stream, { status: value.status, statusText: value.statusText, headers: value.headers });\n });\n return { payload: createFromFetch<RscPayload>(forFlight), settled };\n}\n\n/**\n * Whether the browser hands us its navigations. Gated on `sourceElement` rather than on `navigation` itself:\n * Chrome shipped the event in 102 and that property only in 135, and without it a `data-native` link cannot\n * be told from any other — so the older window would soft-navigate the very links that asked not to be.\n *\n * Where this is false there is no interception at all and every navigation is a real browser load, which a\n * server-rendered app answers correctly on its own. Only the soft part is missing.\n *\n * Both globals are tested, and neither is touched before: this runs at module scope, where a ReferenceError\n * would take the whole client runtime down with it rather than degrading anything.\n */\nconst canSoftNavigate = typeof navigation !== 'undefined' && typeof NavigateEvent !== 'undefined' && 'sourceElement' in NavigateEvent.prototype;\n\n/**\n * The runtime owns a soft navigation's scroll, so the browser's own restoration has to be off: left on, a\n * traversal restores the destination's offset against the outgoing tree before the payload for that entry\n * has even been asked for, and the incoming tree overwrites it. `manual` only concerns the entries this\n * document creates — a navigation to another document creates its own entry `auto` — and it also turns the\n * browser's reload restoration off, which {@link readStoredScrollPositions} and the first layout effect put\n * back.\n *\n * Gated on the soft router: below the Navigation API floor every navigation is a real document load, which\n * a server-rendered app answers correctly and the browser restores correctly, and taking that over without\n * a router to repaint the entry would strand the visitor at the top.\n */\nif (canSoftNavigate) {\n try {\n history.scrollRestoration = 'manual';\n } catch {\n // A preference, not a requirement: where it cannot be set, the browser's restoration and the runtime's\n // own can race on a traversal, and the runtime's runs at commit, after.\n }\n}\n\n/** A scroll offset, in the coordinates `window.scrollTo` takes and `window.scrollX`/`window.scrollY` return. */\ntype ScrollPoint = { x: number; y: number };\n\n/**\n * Where each history entry of this document was left, keyed by its Navigation API key. In memory for the\n * document's life; {@link persistScrollPositions} also writes it to `sessionStorage` so a reload — which\n * the `manual` mode above stops the browser restoring — lands where the last document was left.\n */\nconst scrollPositions = new Map<string, ScrollPoint>();\n\n/** The `sessionStorage` key holding {@link scrollPositions}. */\nconst SCROLL_STORAGE_KEY = 'rshono:scroll';\n\n/** How many entries are kept in that snapshot; the oldest falls out first — `Map` iteration order. */\nconst SCROLL_STORAGE_LIMIT = 50;\n\n/** The key of the history entry being shown, or `undefined` where the soft router does not exist. */\nfunction currentEntryKey(): string | undefined {\n return canSoftNavigate ? navigation.currentEntry?.key : undefined;\n}\n\n/**\n * Records where the outgoing entry is being left. Read at `navigate` time — before the browser commits the\n * new entry — and at `pagehide`, so whatever the navigation turns out to be, the entry it leaves has a\n * position to come back to.\n */\nfunction rememberCurrentScroll(): void {\n const key = currentEntryKey();\n if (key) scrollPositions.set(key, { x: window.scrollX, y: window.scrollY });\n}\n\n/** The position `key` was left at, or `undefined` when this document never saw it. */\nfunction scrollPointFor(key: string | undefined): ScrollPoint | undefined {\n return key === undefined ? undefined : scrollPositions.get(key);\n}\n\n/**\n * Reads the last document's snapshot back into {@link scrollPositions}. Called once, on startup, before the\n * first payload commits: the in-memory map alone would lose every entry the moment the document is replaced.\n */\nfunction readStoredScrollPositions(): void {\n try {\n const raw = sessionStorage.getItem(SCROLL_STORAGE_KEY);\n if (!raw) return;\n for (const [key, point] of Object.entries(JSON.parse(raw) as Record<string, ScrollPoint>)) {\n if (Number.isFinite(point?.x) && Number.isFinite(point?.y)) scrollPositions.set(key, point);\n }\n } catch {\n // Blocked site data, or a snapshot written by a different version. Either way there is nothing to restore,\n // and the page is still correct without it.\n }\n}\n\n/** Writes {@link scrollPositions} out, oldest first, bounded — see {@link SCROLL_STORAGE_LIMIT}. */\nfunction persistScrollPositions(): void {\n try {\n while (scrollPositions.size > SCROLL_STORAGE_LIMIT) {\n const oldest = scrollPositions.keys().next().value;\n if (oldest === undefined) break;\n scrollPositions.delete(oldest);\n }\n sessionStorage.setItem(SCROLL_STORAGE_KEY, JSON.stringify(Object.fromEntries(scrollPositions)));\n } catch {\n // Blocked site data: the in-memory map still carries this document's navigations.\n }\n}\n\n/**\n * The snapshot starts with the document, not with hydration: the page is visible and clickable while the\n * initial payload streams, and a reload or a navigation away in that window would otherwise lose the offset\n * now that `manual` has stopped the browser restoring it. Nothing here depends on the router being mounted,\n * so it does not wait for {@link listenNavigation}.\n */\nif (canSoftNavigate) {\n window.addEventListener('pagehide', () => {\n rememberCurrentScroll();\n persistScrollPositions();\n });\n}\n\n/**\n * Drops a navigation's result promises. Both reject when a navigation is superseded or cancelled — routine\n * here, since a second click is meant to abandon the first — and unhandled they would be reported as faults.\n */\nfunction settle(result: NavigationResult): void {\n const ignore = () => {};\n void result.committed?.catch(ignore);\n void result.finished?.catch(ignore);\n}\n\n/**\n * The mark {@link loadDocument} puts on its navigations, so the `navigate` listener below recognizes them as\n * the runtime's own. A symbol because the identity has to survive the trip through the browser intact:\n * `NavigateEvent.info` hands the value back by reference, so only the navigation that was given it matches.\n */\nconst documentNavigation = Symbol('rshono:document-navigation');\n\n/**\n * Performs a navigation the router below must **not** intercept, and returns having asked for it.\n *\n * `listenNavigation` intercepts a `reload` on purpose — that is what `router.refresh()` is — and every caller\n * here is reaching for a *new document* precisely because the current one cannot be repaired: the React root\n * a soft load would render into is the thing that just failed, or is about to be torn down. Intercepted, the\n * escape hatch becomes a payload fetch that lands nowhere — which is how a late `notFound()` left the tab on\n * its Suspense fallback with no second document ever arriving, and how a late `redirect()` moved the address\n * bar to a page it then failed to render.\n *\n * `replace` puts the loaded document in place of the current entry rather than after it, which is what a\n * redirect recovery owes: the entry being left is the URL that raised the redirect, and a 30x would have\n * replaced it, so Back must reach whatever preceded it rather than the URL that redirects again.\n *\n * The mark rides the navigation itself, through `info`, so the listener recognizes the event that owns it\n * instead of consuming a flag set in advance. There is no state to clear and none to leak: a navigation the\n * browser refuses cannot make the next one a full load. Below the Navigation API there is no interception to\n * opt out of, and `location.*` is already a document load.\n */\nfunction loadDocument(href?: string, { replace = false }: { replace?: boolean } = {}): void {\n finishAttempt(activeAttempt, { kind: 'document-navigation' });\n if (!canSoftNavigate) {\n if (href === undefined) window.location.reload();\n else if (replace) window.location.replace(href);\n else window.location.assign(href);\n return;\n }\n\n try {\n settle(\n href === undefined\n ? navigation.reload({ info: documentNavigation })\n : navigation.navigate(href, { history: replace ? 'replace' : 'auto', info: documentNavigation }),\n );\n } catch {\n // The Navigation API refuses a document that is not fully active — it is unloading — and a URL it cannot\n // parse. Both callers are recovery paths, where a throw here becomes an unhandled rejection rather than\n // the document load they asked for. `location.*` is the same load without the interception, and its own\n // refusal (the same unparseable URL) is swallowed because there is then no load left to make.\n try {\n if (href === undefined) window.location.reload();\n else if (replace) window.location.replace(href);\n else window.location.assign(href);\n } catch {\n // Nothing to navigate to. The caller is already recovering from a failure, and the address bar still\n // describes the document on screen.\n }\n }\n}\n\n// The imperative actions behind `useNavigation().router`. Each one only *asks*: the browser turns it into a\n// `navigate` event, which is where `listenNavigation` answers it — so a `router.push` and a link click reach\n// the same code by the same route, and inherit the same fetch, scroll and `pending` flag.\n// Carry each caller's completion through its browser event, fetch, and DOM commit.\nconst attemptMark = Symbol('rshono:navigation-attempt');\ntype NavigationAttempt = {\n mark: typeof attemptMark;\n hop: number;\n done: boolean;\n browserOnlyRendered: boolean;\n promise: Promise<NavigationOutcome>;\n resolve: (outcome: NavigationOutcome) => void;\n reject: (error: unknown) => void;\n};\nlet activeAttempt: NavigationAttempt | undefined;\nlet traversalAttempt: { attempt: NavigationAttempt; key: string } | undefined;\n\nfunction finishAttempt(attempt: NavigationAttempt | undefined, outcome: NavigationOutcome): void {\n if (!attempt || attempt.done) return;\n attempt.done = true;\n attempt.resolve(outcome);\n if (activeAttempt === attempt) activeAttempt = undefined;\n}\n\nfunction rejectAttempt(attempt: NavigationAttempt | undefined, error: unknown): void {\n if (!attempt || attempt.done) return;\n attempt.done = true;\n attempt.reject(error);\n if (activeAttempt === attempt) activeAttempt = undefined;\n}\n\nfunction newAttempt(): NavigationAttempt {\n const { promise, resolve, reject } = Promise.withResolvers<NavigationOutcome>();\n // Ignoring a router call must not create an unhandled rejection; awaiting this original promise still rejects.\n void promise.catch(() => {});\n return { mark: attemptMark, hop: 0, done: false, browserOnlyRendered: false, promise, resolve, reject };\n}\n\nfunction requestNavigation(attempt: NavigationAttempt, run: () => NavigationResult): Promise<NavigationOutcome> {\n const hop = attempt.hop;\n try {\n const result = run();\n settle(result);\n void result.finished?.then(\n () => {\n if (attempt.hop === hop && attempt.browserOnlyRendered) {\n finishAttempt(attempt, { kind: 'rendered', url: new URL(location.href) });\n }\n },\n (error: unknown) => {\n if (attempt.hop === hop) rejectAttempt(attempt, error);\n },\n );\n } catch (error) {\n rejectAttempt(attempt, error);\n }\n return attempt.promise;\n}\n\nfunction navigateAttempt(href: string, history: 'push' | 'replace', attempt = newAttempt()): Promise<NavigationOutcome> {\n if (!canSoftNavigate) {\n if (history === 'replace') window.location.replace(href);\n else window.location.assign(href);\n finishAttempt(attempt, { kind: 'document-navigation' });\n return attempt.promise;\n }\n return requestNavigation(attempt, () => navigation.navigate(href, { history, info: attempt }));\n}\n\nfunction push(href: string): Promise<NavigationOutcome> {\n return navigateAttempt(href, 'push');\n}\n\nfunction replace(href: string): Promise<NavigationOutcome> {\n return navigateAttempt(href, 'replace');\n}\n\nfunction back(): Promise<NavigationOutcome> {\n if (!canSoftNavigate) {\n window.history.back();\n return Promise.resolve({ kind: 'document-navigation' });\n }\n if (!navigation.canGoBack) return Promise.resolve({ kind: 'no-op' });\n const attempt = newAttempt();\n return requestNavigation(attempt, () => navigation.back({ info: attempt }));\n}\n\nfunction forward(): Promise<NavigationOutcome> {\n if (!canSoftNavigate) {\n window.history.forward();\n return Promise.resolve({ kind: 'document-navigation' });\n }\n if (!navigation.canGoForward) return Promise.resolve({ kind: 'no-op' });\n const attempt = newAttempt();\n return requestNavigation(attempt, () => navigation.forward({ info: attempt }));\n}\n\nfunction refresh(): Promise<NavigationOutcome> {\n if (!canSoftNavigate) {\n window.location.reload();\n return Promise.resolve({ kind: 'document-navigation' });\n }\n const attempt = newAttempt();\n return requestNavigation(attempt, () => navigation.reload({ info: attempt }));\n}\n\n/**\n * How long a recovery document load is given to replace this one before the framework paints the panel the\n * load stands in for. Both recoveries — a late `notFound()` and a payload whose render tore the root down —\n * ask the browser for a real document, and this timer is all that is left when one is refused or swallowed.\n */\nconst RECOVERY_GRACE_MS = 2000;\n\n/** The `sessionStorage` key bounding the recovery reload for one URL. Spent here, released in {@link main}. */\nconst lateNotFoundKey = (): string => `rshono:late-not-found:${documentUrl()}`;\n\n/**\n * Spends the one reload a late `notFound()` gets, or paints if it has already been spent for this URL.\n *\n * `redirect()` is terminal on the client — there is somewhere to navigate to — and `notFound()` is not: the\n * response is already committed as a 200, so the only recovery left is asking for the page again and hoping\n * the signal comes early enough this time to be a real 404. That works where the lateness was incidental, a\n * boundary that happened to resolve after the shell on a slow request. Where it is structural — a page that\n * always signals from a late boundary — the reload gets a byte-identical response and reloads again, and the\n * tab spins until the visitor leaves. In production nothing is logged, because the warning that explains this\n * is `isDev`-only.\n *\n * So it is bounded: one reload per URL per tab, then {@link showLateNotFound}. `sessionStorage` because the\n * value has to outlive the document it is written in and must not outlive the tab, and keyed by URL so a\n * second page's late signal still gets its own attempt.\n */\nfunction reloadOnceForLateNotFound(): void {\n const key = lateNotFoundKey();\n let spent: boolean;\n try {\n spent = sessionStorage.getItem(key) !== null;\n if (!spent) sessionStorage.setItem(key, '1');\n } catch {\n // Storage can throw outright where site data is blocked, and a page that cannot count its reloads has\n // to pick a side. It picks the terminating one: a message on a page that might have recovered is a\n // worse outcome than a reload loop only by a lot less.\n spent = true;\n }\n if (spent) {\n showLateNotFound();\n return;\n }\n\n loadDocument();\n\n // The reload wins this race whenever it happens at all: the document goes away and takes the timer with\n // it. What this covers is a reload that does not happen — swallowed by an interceptor, refused by the\n // browser, held by a `beforeunload` — which used to leave the visitor on a Suspense fallback with nothing\n // coming and nothing said. The panel is the honest answer in that case too.\n setTimeout(() => {\n if (!document.querySelector('[data-rshono-fatal]')) showLateNotFound();\n }, RECOVERY_GRACE_MS);\n}\n\n/**\n * Turns a control-signal digest — how `redirect()` / `notFound()` reach the browser — into a real\n * navigation. Returns false for anything else, so callers fall through to their own handling.\n *\n * `hard` forces a full document load, for signals that surfaced *through React*: it unmounts the root on\n * an uncaught error, leaving no live tree to soft-navigate with.\n *\n * A redirect is followed *replacing* the entry that raised it, the way a 30x replaces the URL that answered\n * with one. `history` lets the action-reply paths that must not — the fetch catch, and a digest surfacing\n * through React during the reply's render — keep the push they have always had. `notFound()` has nowhere to\n * go but a reload, and a reload is its own entry already.\n */\nfunction handleControlDigest(error: unknown, { hard = false, history = 'replace' }: { hard?: boolean; history?: 'push' | 'replace' } = {}): boolean {\n const digest = (error as { digest?: unknown } | null)?.digest;\n if (!isControlDigest(digest)) return false;\n const redirect = parseRedirectDigest(digest);\n if (!redirect) {\n reloadOnceForLateNotFound();\n } else if (hard) {\n // The URL is resolved first: a malformed location then throws here, before any navigation is asked for.\n // Replacing is what keeps the URL that raised the redirect from becoming an entry Back bounces through.\n loadDocument(new URL(redirect.location, window.location.href).href, { replace: history === 'replace' });\n } else if (history === 'replace') {\n void replace(redirect.location);\n } else {\n void push(redirect.location);\n }\n return true;\n}\n\n/**\n * Scrolls the document to its start.\n *\n * The options form rather than `scrollTo(0, 0)`: the two-argument call is `auto`, which follows a\n * `scroll-behavior` the app may have set on `html`, and a soft navigation that animates its own reset reads\n * as a glitch rather than a page change.\n */\nfunction scrollToTop(): void {\n window.scrollTo({ top: 0, left: 0, behavior: 'instant' });\n}\n\n/** Puts a saved offset back. Instant for the same reason {@link scrollToTop} passes it. */\nfunction scrollToPoint(point: ScrollPoint): void {\n window.scrollTo({ top: point.y, left: point.x, behavior: 'instant' });\n}\n\n/**\n * How long a commit waits for a fragment target or `autofocus` element that a boundary has not streamed in\n * yet. Past it the fallback stands — the top of the document, or body focus — and the watch is dropped, so a\n * fragment that names nothing leaves no observer running behind it.\n */\nconst ELEMENT_WATCH_TIMEOUT_MS = 5_000;\n\n/**\n * Elements a commit asked for that were not in the tree yet: a `#hash` target inside a still-suspended\n * `<AsyncBoundary>`, or the `autofocus` element of a page being traversed into.\n *\n * One `MutationObserver` answers every pending watch. A streamed payload inserts its chunks as separate\n * mutations, so the observer re-checks each watch's lookup until one hits or its timer retires it. A watch is\n * only ever live across one payload: the next navigation drops them all, so a destination the user has left\n * cannot scroll or focus the page that replaced it.\n */\ntype PendingElementWatch = {\n find: () => Element | null;\n run: (element: Element) => void;\n /** Retires the watch if the element never arrives. */\n timer: ReturnType<typeof setTimeout>;\n};\n\nconst pendingElementWatches = new Set<PendingElementWatch>();\nlet elementObserver: MutationObserver | null = null;\n\nfunction stopElementWatch(watch: PendingElementWatch): void {\n clearTimeout(watch.timer);\n if (!pendingElementWatches.delete(watch)) return;\n if (pendingElementWatches.size === 0) {\n elementObserver?.disconnect();\n elementObserver = null;\n }\n}\n\n/** Drops every watch; a new navigation owns the screen from here. */\nfunction cancelElementWatches(): void {\n for (const watch of [...pendingElementWatches]) stopElementWatch(watch);\n}\n\n/**\n * Runs `run` as soon as `find` finds an element, or gives up after {@link ELEMENT_WATCH_TIMEOUT_MS}. When\n * the element is already there, `run` happens synchronously. `find` and `run` are always passed as a matching\n * pair; the type-erasure here is what lets one observer serve watches of different element shapes.\n */\nfunction watchForElement<T extends Element>(find: () => T | null, run: (element: T) => void): void {\n const present = find();\n if (present) {\n run(present);\n return;\n }\n if (elementObserver === null) {\n elementObserver = new MutationObserver(() => {\n for (const watch of [...pendingElementWatches]) {\n const element = watch.find();\n if (element) {\n stopElementWatch(watch);\n watch.run(element);\n }\n }\n });\n elementObserver.observe(document.documentElement, { childList: true, subtree: true });\n }\n const watch: PendingElementWatch = {\n find,\n run: run as (element: Element) => void,\n timer: setTimeout(() => stopElementWatch(watch), ELEMENT_WATCH_TIMEOUT_MS),\n };\n pendingElementWatches.add(watch);\n}\n\n/**\n * Scrolls to a fragment's target the way the browser's own fragment jump does.\n *\n * `scrollIntoView` is the algorithm that honours `scroll-padding-top` on the scrolling box and\n * `scroll-margin-top` on the target, which `window.scrollTo` does not. The lookup follows the browser's\n * \"find a potential indicated element\": the id first, then the name. A malformed percent-escape falls back\n * to the literal fragment, and a fragment nothing matches gets the top of the document — what a browser\n * gives a missing anchor on a real load.\n *\n * A streamed payload commits its shell before a target inside a suspended boundary exists, so a miss is not\n * final: the top is applied right away, and the watch follows the fragment in when its element arrives.\n */\nfunction jumpToAnchor(hash: string): void {\n const raw = hash.startsWith('#') ? hash.slice(1) : hash;\n // No special case for `#top`: the browser only treats it as the top of the document when no element\n // matches, and the fallback below is that top.\n if (raw === '') {\n scrollToTop();\n return;\n }\n let id = raw;\n try {\n id = decodeURIComponent(raw);\n } catch {\n // Malformed escape — the literal fragment is the better guess at the id than nothing.\n }\n const find = () => document.getElementById(id) ?? document.getElementsByName(id)[0] ?? null;\n const target = find();\n if (target) {\n target.scrollIntoView();\n return;\n }\n scrollToTop();\n watchForElement(find, (element) => element.scrollIntoView());\n}\n\n/**\n * Moves focus the way the browser's `focusReset: 'after-transition'` does: the first `autofocus` element,\n * else the document body. A traversal is no longer intercepted, so the browser performs no focus reset for\n * it; without this, Back would leave focus on the link that was clicked on the page being left, and the next\n * Tab would resume there. `preventScroll` because the traversal's own offset has just been restored.\n *\n * The page may still be streaming — a traversal into a page whose `autofocus` element sits in a suspended\n * boundary — and the browser's own reset follows the element in, so this watches for it with the same bound\n * as a fragment.\n */\nfunction resetFocus(): void {\n const autofocus = document.querySelector<HTMLElement>('[autofocus]');\n if (autofocus) {\n autofocus.focus({ preventScroll: true });\n return;\n }\n document.body.focus({ preventScroll: true });\n watchForElement(\n () => document.querySelector<HTMLElement>('[autofocus]'),\n (element) => {\n // Only if focus is still where this reset left it: a user who has since focused something else keeps it.\n if (document.activeElement === document.body) element.focus({ preventScroll: true });\n },\n );\n}\n\n/**\n * Owns one payload render's completion and post-commit work, even when React retries or supersedes another\n * render. `commit` runs the post-commit callback and resolves; `supersede` releases the waiter without\n * running that callback; `fail` rejects it because React has torn the tree down and it never will.\n */\ntype RenderRecord = {\n payload: RscPayload;\n href: string;\n committed: Promise<void>;\n commit: () => void;\n supersede: () => void;\n fail: (error: unknown) => void;\n /**\n * Whether a document load can recover this render when React tears it down before it commits. A navigation\n * payload names a URL that renders the failure again — the server answers its document with the app's error\n * page — so the load is the way back. An action reply does not: a GET of the same URL does not re-run the\n * action, so a load would silently discard the error, and the fatal panel is the answer instead.\n */\n recoversByLoad: boolean;\n};\n\n/**\n * Puts a payload on screen, resolving once React has committed it. Replaced by `BrowserRoot`'s own on mount;\n * the default covers the window before hydration, where `setServerCallback` is already registered but there\n * is no root to update — a reload is the honest answer, and nothing after it needs to run.\n *\n * `afterCommit`, when given, runs in the same layout effect that releases the commit: after the new tree is\n * in the DOM and before the browser paints, which is the only moment a `#hash` target exists and the\n * pre-scroll position has not been shown.\n */\nlet setPayload: (payload: RscPayload, afterCommit?: () => void, options?: { recoversByLoad?: boolean }) => Promise<void> = () => {\n window.location.reload();\n return new Promise<void>(() => {});\n};\n\n/**\n * The payload {@link setPayload} handed React that is still waiting to commit, or `undefined` once it has.\n *\n * Read by `onUncaughtError`, where React has decided to unmount the root. A navigation payload that never\n * committed is the one case a document load can still repair: the URL already names its destination, and\n * every recovery the runtime has — `popstate`, a link click, `setPayload` — writes into a root that no longer\n * exists. The server answers that document request with the app's error page, which is a root of its own. An\n * action reply is not: a GET of the URL it was called from does not re-run the action, so the page renders as\n * if nothing had happened and the panel is the answer. Deliberately `undefined` for the initial payload and\n * cleared as soon as a render commits: a deterministic client fault must reach the fatal panel rather than\n * reload the tab forever.\n *\n * Failing the render rejects the commit promise rather than settling it as a success, so every waiter —\n * `loadPayload`'s caller, the prepared handler — learns the render it asked for has failed and can take its\n * recovery branch. A render React is only suspending is not failed: it has not given up on it, and neither\n * may the navigation.\n */\nlet pendingRender: RenderRecord | undefined;\n\n/**\n * The history mode for a `redirect()` that surfaced through React, where {@link pendingRender} is the render\n * that raised it. A navigation payload names the URL that raised the redirect, so the redirect replaces that\n * entry. An action reply re-renders the page the visitor is already on — a GET of it does not re-run the\n * action — so its redirect keeps the push the action's other redirect paths have, and Back returns to the\n * page that submitted the form. `undefined` — the initial payload, or a render past its commit — is not an\n * action reply and replaces.\n */\nfunction controlDigestHistory(): 'push' | 'replace' {\n return pendingRender?.recoversByLoad === false ? 'push' : 'replace';\n}\n\n/**\n * Re-dispatches the payload already waiting to commit, for {@link loadPayload}'s lost-ping retry. Unlike\n * {@link setPayload} it creates and releases no commit promise, so re-rendering the same payload cannot\n * resolve the navigation's commit early. Assigned with {@link setPayload} by `BrowserRoot`.\n */\nlet reapplyPayload: () => void = () => {};\n\n/**\n * Runs a navigation's work through `useNavigationTransition`'s runner, which tracks the promise it returns so\n * `useNavigation().pending` stays true across the whole round-trip rather than only inside a React transition.\n * The default covers the window before hydration, where no root observes `pending`.\n */\nlet startNav: (run: () => void | Promise<void>) => void = (run) => {\n void run();\n};\n\n/**\n * The navigation whose payload is allowed to settle the screen. React runs async work concurrently, so two\n * navigations are two live fetches with no ordering between them; without this a slow first response landing\n * after a fast second one repaints the page the user already left. The Navigation API aborts an intercepted\n * navigation when a newer one starts, but a traversal has no `event.signal` to watch — `popstate` arrives\n * after the browser has already committed it — so ordering is the runtime's own for those.\n */\nlet currentNavigation = 0;\n\n/** An urgent traversal releases a suspended destination in favor of the last committed payload. */\nfunction restoreCommittedPayload(payload: RscPayload): void {\n currentNavigation++;\n // The payload has rendered before, but an uncaught error would still tear the root down. Nothing awaits\n // this commit, so the rejection needs a consumer of its own to reach the document-load recovery.\n void setPayload(payload).catch(() => loadDocument());\n}\n\n/**\n * A navigation fetch, and whether its payload has been handed to React. An **applied** fetch is deliberately\n * not aborted when it loses the screen: React is still reading its stream, and aborting it rejects every\n * flight chunk still in flight — the nearest boundary renders the `AbortError` as a failure, and the root can\n * unwind into React's \"Rendered more hooks than during the previous render\" (minified error #310). The commit\n * of a newer payload is the first moment the old tree is off the screen and out of React, so the abort is\n * deferred to here, where the rejected chunks have nowhere to surface.\n *\n * An unapplied fetch has no such reader: nothing holds its stream, so it can be stopped the moment it loses\n * the screen — when a newer navigation starts, or when the browser cancels this navigation and nothing takes\n * its place (a fragment jump or a download, where no later commit would ever run an abort). Leaving those to\n * a commit that never comes is how a render nobody is waiting for stays alive.\n *\n * Pruned when a payload commits and when a newer navigation starts. A fetch stopped by a browser cancellation\n * waits for one of those to drop it; the entries that remain are the applied ones plus the current fetch.\n */\ntype NavigationFetch = { navigation: number; controller: AbortController; applied: boolean };\nlet navigationFetches: NavigationFetch[] = [];\n\n/** Stop only the requests whose streams no longer belong to a retained render. */\nfunction abortNavigationFetches(shouldAbort: (fetch: NavigationFetch) => boolean): void {\n navigationFetches = navigationFetches.filter((fetch) => {\n if (!shouldAbort(fetch)) return true;\n fetch.controller.abort();\n return false;\n });\n}\n\ntype LoadPayloadOptions = {\n /** Available for intercepted navigations; history traversal and dev refresh have no browser signal. */\n signal?: AbortSignal;\n /** Scroll/focus work when needed; refresh and replace preserve the current position. */\n afterCommit?: () => void;\n /** Tracks an imperative router caller; ordinary links and dev refresh have no caller to resolve. */\n attempt?: NavigationAttempt;\n /** A fetch started before its URL committed, from `listenNavigationPreparation`. */\n prepared?: PreparedNavigation;\n};\n\n/**\n * Fetches the payload for `url` and puts it on screen.\n *\n * Resolves once React has **committed** it rather than when the fetch lands: `afterCommit` runs at that\n * point, and a `#hash` target does not exist until the new tree does. Rejects only on a genuine failure —\n * being superseded is not one, and resolves quietly, because the navigation that replaced this one owns the\n * screen from then on.\n *\n * `prepared`, when given, is a fetch that was started before the URL committed: this call takes over its\n * abort wiring, so from here it follows the same applied-fetch rules as one this function started.\n */\nfunction loadPayload(url: string, { signal, afterCommit, attempt, prepared }: LoadPayloadOptions = {}): Promise<void> {\n // This navigation's place in the queue, and its own abort switch: the navigation stops being applied by\n // whichever comes first, the browser superseding it (an intercepted navigation carries `event.signal`) or a\n // newer runtime fetch starting (a traversal, an action, a dev refresh). The fetch itself runs on until its\n // payload is on screen and a newer one commits — see {@link navigationFetches}.\n const navigation = ++currentNavigation;\n const controller = new AbortController();\n const entry: NavigationFetch = { navigation, controller, applied: false };\n navigationFetches.push(entry);\n\n // A newer navigation owns the screen now, and an older fetch whose payload never reached React is reading\n // into a tree that does not exist — stopping it cannot reject a chunk anything holds. One that did reach\n // React waits for this payload's commit; see {@link navigationFetches}.\n abortNavigationFetches((fetch) => fetch !== entry && !fetch.applied);\n\n // The browser supersedes an intercepted navigation the moment a newer one starts, and `signal` is how it\n // says so. A fetch React has been handed keeps running (see {@link navigationFetches}), but one that never\n // reached React stops here: the navigation taking over may be one the runtime does not intercept (a\n // fragment jump, a download), leaving no commit to stop it later.\n let abandoned = signal?.aborted ?? false;\n const abandon = () => {\n abandoned = true;\n if (!entry.applied) controller.abort();\n };\n if (abandoned) abandon();\n else signal?.addEventListener('abort', abandon, { once: true });\n /** Whether this navigation has lost the screen to the browser or to a newer runtime fetch. */\n const stale = (): boolean => abandoned || navigation !== currentNavigation || controller.signal.aborted;\n\n // Deliberately not awaited inside the transition: the scope ends once the payload is handed to React, and\n // React holds `pending` until the update it scheduled commits. Awaiting the commit *inside* the scope would\n // work too, but only because React happens not to gate a commit on its async scope settling — an internal\n // this has no reason to depend on across the whole `^19.1.0` peer range.\n let committed: Promise<void> | undefined;\n let committedSettled = false;\n const run = async () => {\n let fetched: FetchedPayload;\n if (prepared) {\n // The payload is already on the wire and its abort switch belonged to the navigation event up to the\n // commit. Take over here so the runtime's ownership rules apply from now on: a superseded fetch that\n // never reached React stops at once, while one React is reading waits for a newer commit.\n const owned = prepared;\n const abortPrepared = () => owned.controller.abort(controller.signal.reason);\n if (controller.signal.aborted) abortPrepared();\n else controller.signal.addEventListener('abort', abortPrepared, { once: true });\n void owned.fetched.settled.then(() => controller.signal.removeEventListener('abort', abortPrepared));\n fetched = owned.fetched;\n } else {\n fetched = requestPayload(url, controller.signal);\n }\n const nextPayload = await fetched.payload;\n // Checked again after the await because the fetch may already have resolved by then, and applying it\n // would repaint a page the user has left.\n if (stale()) return;\n if (nextPayload.redirect) {\n // Replacing for the same reason as {@link handleControlDigest}: the URL whose payload carried the\n // redirect is the entry being left, and a push would make Back bounce through it into the same redirect.\n if (attempt) {\n attempt.hop++;\n void navigateAttempt(nextPayload.redirect, 'replace', attempt);\n } else void replace(nextPayload.redirect);\n return;\n }\n // The fetch crossed an await, so its payload update needs a new synchronous transition scope.\n // Keep the commit promise outside the async Action; React tracks the scheduled update until commit.\n startNavigationPayload(() => {\n // From here React holds this payload's stream, so a superseded fetch may not be stopped until a newer\n // payload commits — see {@link navigationFetches}.\n navigationModels.set(controller, nextPayload);\n entry.applied = true;\n committed = setPayload(nextPayload, afterCommit);\n // Either way this render is settled, so the lost-ping retry below must not wait for it or re-apply it:\n // a failed render would re-enter a root React has already torn down.\n void committed.then(\n () => (committedSettled = true),\n () => (committedSettled = true),\n );\n });\n\n // This payload is on screen, so every fetch it superseded is reading into a tree React has replaced.\n // Stopping them now cannot reject a chunk the committed tree holds — see {@link navigationFetches}.\n // Only the older ones: a newer navigation may have started while this payload was in flight, and its\n // fetch is the one the screen is waiting for.\n void committed?.then(\n () => {\n if (renderedModel !== nextPayload) return;\n navigationFetches = navigationFetches.filter((fetch) => {\n if (fetch.navigation >= navigation) return true;\n fetch.controller.abort();\n return false;\n });\n },\n // A rejected commit is the caller's to report; this chain only exists to reap older fetches.\n () => {},\n );\n // A streamed payload can suspend a transition on a flight chunk that resolves after the shell without\n // React ever pinging the suspended lane back, which strands the navigation on the previous tree. The\n // chunks have all landed by the time the stream closes, so one re-application — still a transition, so a\n // payload that is waiting on something other than flight keeps the #52 behaviour — commits the render a\n // lost ping stranded. It goes through `reapplyPayload` rather than `setPayload`: the payload is not\n // replaced, so the commit the navigation waits on has to stay attached to it. The macrotask lets the\n // decoder process the last chunk and React's own retry run first, so the normal path is not interrupted.\n void fetched.settled.then(() => {\n if (stale() || committedSettled) return;\n setTimeout(() => {\n if (!stale() && !committedSettled) React.startTransition(reapplyPayload);\n }, 0);\n });\n };\n\n // `startTransition` runs the work but hands nothing back, so the promise carrying a failure is caught by\n // the rejection handler on `work` below instead. Assigned synchronously: React invokes the callback before\n // `startNav` returns.\n let work!: Promise<void>;\n startNav(() => (work = run()));\n\n return work.then(\n // Undefined whenever nothing was applied — an abort, or a redirect — and there is then nothing to wait for.\n () => committed,\n (error: unknown) => {\n // Checked before the error is read: an abort is this navigation being replaced, and the one that\n // replaced it owns the outcome.\n if (stale() || handleControlDigest(error)) return;\n throw error;\n },\n );\n}\n\n/**\n * Whether a destination names a file rather than a page. `public/`, `/_static` and an endpoint route that\n * serves a document (`/llms.txt`, `/sitemap.xml`) answer an RSC fetch with the file itself, not a flight\n * payload — so intercepting one buys nothing: the payload never arrives, and the only recovery left is the\n * document load the browser would have made directly. Handing it that navigation up front also gives the\n * entry the file loads into the browser's own history, so Back is an ordinary cross-document traversal. An\n * intercepted entry is same-document by construction, and traversing one with nothing to repaint it changes\n * the URL and nothing else — which is what a Back press out of an opened file was doing.\n *\n * A dot in the last path segment rather than a list of extensions: a list is never complete, and every miss\n * is the failed round trip above. A page route whose last segment carries a dot (`/release-1.0`) therefore\n * costs a document load — the direction to err in, and what a `data-native` link already asks for by hand.\n */\nfunction namesAFile(href: string): boolean {\n const lastSegment = new URL(href).pathname.split('/').pop() ?? '';\n return lastSegment.includes('.');\n}\n\n/**\n * Navigations the browser can hand over but shouldn't:\n *\n * - a fragment jump, which is same-document already and needs no payload — the browser's own jump is the one\n * that honours `scroll-padding-top`, and re-rendering would pull the target out from under it;\n * - a download, which is not a navigation of this page at all;\n * - a `POST` form, which is a submission and the server's to answer (a `GET` form carries its fields in the\n * URL, has no `formData`, and soft-navigates like any other link);\n * - a link marked `data-native`, the documented opt-out;\n * - a destination that names a file — see {@link namesAFile}.\n */\nfunction leaveToBrowser(event: NavigateEvent): boolean {\n return (\n event.hashChange ||\n event.downloadRequest !== null ||\n event.formData !== null ||\n event.sourceElement?.hasAttribute('data-native') === true ||\n namesAFile(event.destination.url)\n );\n}\n\n/**\n * The scroll a committing navigation owes: a push reaches its own fragment or the top, an in-place change\n * stays where it is. Read at commit rather than at dispatch, so a redirect the preparation followed lands\n * on the fragment it actually committed.\n */\nfunction afterCommitFor(event: NavigateEvent): (() => void) | undefined {\n if (event.navigationType !== 'push') return undefined;\n const { hash } = new URL(event.destination.url);\n return hash === '' ? scrollToTop : () => jumpToAnchor(hash);\n}\n\n/** Applies a prepared payload and resolves after React commits it, keeping native `finished` pending until then. */\nfunction applyPrepared(event: NavigateEvent, prepared: PreparedNavigation): Promise<void> {\n const info = event.info as NavigationAttempt | undefined;\n const attempt = info?.mark === attemptMark ? info : undefined;\n const hop = attempt?.hop;\n return loadPayload(event.destination.url, { signal: event.signal, afterCommit: afterCommitFor(event), attempt, prepared }).then(\n () => {\n if (attempt?.hop === hop && !event.signal.aborted) finishAttempt(attempt, { kind: 'rendered', url: new URL(location.href) });\n },\n (error: unknown) => {\n rejectAttempt(attempt, error);\n loadDocument();\n },\n );\n}\n\n/**\n * The whole router, in one listener.\n *\n * Every navigation the page can make arrives as a `navigate` event — a link click, a `GET` form, a\n * `history.pushState`, the back button, `navigation.reload()` — already filtered by the browser: it does not\n * fire for a middle-click, a modified click or a new tab, and reports `canIntercept: false` for anything\n * cross-origin, or for a traversal that leaves the app. Those need no handling here; they are left alone, and\n * the browser performs them as it always would.\n */\nfunction listenNavigation(): () => void {\n if (!canSoftNavigate) return () => {};\n const disposePreparation = listenNavigationPreparation({\n fetchPayload: requestPayload,\n shouldIntercept: (event) => event.info !== documentNavigation && event.canIntercept && !leaveToBrowser(event),\n canCommitInPlace: (href) => !namesAFile(href),\n apply: applyPrepared,\n fallbackToDocument: loadDocument,\n });\n\n const onNavigate = (event: NavigateEvent) => {\n // A document navigation the runtime asked for itself, marked through `info`. Checked before the scroll\n // snapshot: the document is going away, so where its entry was left does not matter, and an unrelated\n // later navigation can never be mistaken for this one.\n if (event.info === documentNavigation) return;\n\n const info = event.info as NavigationAttempt | undefined;\n const attempt = info?.mark === attemptMark ? info : undefined;\n if (activeAttempt && activeAttempt !== attempt) rejectAttempt(activeAttempt, new DOMException('Navigation superseded', 'AbortError'));\n activeAttempt = attempt;\n traversalAttempt = undefined;\n\n // A commit for the destination being left is no longer the screen's; its pending fragment target (or\n // `autofocus` element) must not scroll or focus the page that replaces it.\n cancelElementWatches();\n\n // Whatever the browser is about to do with this navigation, the entry it is leaving is about to lose the\n // offset it was at, and nothing else in this document will put it back. Saved before the branches below\n // return, so a fragment the browser performs itself is covered too.\n rememberCurrentScroll();\n\n if (!event.canIntercept || leaveToBrowser(event)) {\n if (attempt) {\n if (event.hashChange) {\n attempt.browserOnlyRendered = true;\n } else finishAttempt(attempt, { kind: 'document-navigation' });\n }\n return;\n }\n\n // A traversal is repainted by the `popstate` listener below, not intercepted. `intercept`ing one is what\n // makes WebKit stall the rendered viewport for about three seconds on a back swipe\n // (bugs.webkit.org/319414): the view gesture's snapshot is only removed once the navigation finishes, and\n // React's root attaches the wheel listener the bug also needs. Letting the traversal through means the\n // browser commits the entry straight away, and the runtime puts the payload on screen when it arrives.\n if (event.navigationType === 'traverse') {\n if (attempt) traversalAttempt = { attempt, key: event.destination.key };\n return;\n }\n\n // The preparation listener claimed this push or replace: it set the scroll and focus options and will\n // apply the prepared payload from its own precommit, so there is no handler to register here.\n if (isPreparedNavigation(event)) return;\n\n // A replace or a refresh stays where it is, so neither should move. A push starts at the top of the\n // page, or at its fragment — and that scroll is the runtime's own now: WebKit performs no\n // `after-transition` reset at all for an intercepted push (bugs.webkit.org/304593). Chromium skips it\n // too, and a fragment jump rides the same code path. Passing `manual` here makes the browser hand the\n // handler over without scrolling; the `afterCommit` callback reaches the target once the new tree is on\n // screen. Focus stays the browser's, reset after the transition.\n const inPlace = event.navigationType === 'replace' || event.navigationType === 'reload';\n const hop = attempt?.hop;\n event.intercept({\n scroll: 'manual',\n focusReset: inPlace ? 'manual' : 'after-transition',\n // The URL has committed by the time this runs, so a failure leaves the address bar describing a page\n // the document is not showing. That is the whole path for a reload, and the fallback path for a push\n // or replace on a browser without precommit support — see `listenNavigationPreparation`. A real load\n // is the only way back to agreement.\n handler: () =>\n loadPayload(event.destination.url, { signal: event.signal, afterCommit: afterCommitFor(event), attempt }).then(\n () => {\n if (attempt?.hop === hop && !event.signal.aborted) finishAttempt(attempt, { kind: 'rendered', url: new URL(location.href) });\n },\n (error: unknown) => {\n rejectAttempt(attempt, error);\n loadDocument();\n },\n ),\n });\n };\n\n /**\n * Repaints a traversal the listener above deliberately left to the browser, and moves the viewport back\n * where the entry was left. `popstate` fires after the browser has committed the entry, so the destination\n * is `navigation.currentEntry` and its saved offset is in {@link scrollPositions}.\n */\n const onPopState = () => {\n const traversal = traversalAttempt;\n const attempt = traversal && traversal.key === currentEntryKey() ? traversal.attempt : undefined;\n traversalAttempt = undefined;\n // Same ownership as `onNavigate`: this traversal's commit replaces whatever the last one was waiting for.\n cancelElementWatches();\n const stored = scrollPointFor(currentEntryKey());\n const hash = location.hash;\n const apply = () => {\n if (stored) scrollToPoint(stored);\n else if (hash !== '') jumpToAnchor(hash);\n else scrollToTop();\n finishAttempt(attempt, { kind: 'rendered', url: new URL(location.href) });\n };\n\n // A fragment-only traversal never changed the payload: the address bar is back at an anchor of the page\n // already on screen, so there is nothing to fetch and nothing to wait for. The browser's own restoration\n // is off, so the offset comes from what `onNavigate` saved when the anchor was followed; no focus reset,\n // which is what leaving those navigations to the browser has always meant.\n if (documentUrl() === renderedUrl) {\n apply();\n return;\n }\n\n // A root redirect transfers completion to the next navigation, just as for push/replace.\n const hop = attempt?.hop;\n void loadPayload(location.href, {\n afterCommit: () => {\n apply();\n // The browser performs this for an intercepted navigation; a traversal is no longer intercepted, so\n // without it Back would leave focus on the link that was clicked on the page being left.\n resetFocus();\n },\n attempt,\n }).then(\n () => {\n if (attempt?.hop === hop) finishAttempt(attempt, { kind: 'rendered', url: new URL(location.href) });\n },\n (error: unknown) => {\n rejectAttempt(attempt, error);\n loadDocument();\n },\n );\n };\n\n navigation.addEventListener('navigate', onNavigate);\n window.addEventListener('popstate', onPopState);\n return () => {\n disposePreparation();\n navigation.removeEventListener('navigate', onNavigate);\n window.removeEventListener('popstate', onPopState);\n };\n}\n\nasync function main() {\n // The assertion is load-bearing under the compiler that builds this: TypeScript 7 declares `nonce` on\n // HTMLElement, 6 declares it on Element. ESLint runs the older lib — where the narrowing is redundant —\n // so it reports an assertion that `tsc` requires. Believe `typecheck`, not the rule.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const cspMeta = document.querySelector('meta[property=\"csp-nonce\"]') as HTMLMetaElement | null;\n if (cspMeta?.nonce) __webpack_nonce__ = cspMeta.nonce;\n\n const initialPayload = await createFromReadableStream<RscPayload>(flightStream);\n\n // The recovery reload landed: this document *is* the `notFound` page, so the signal that could only be a\n // digest on the `RSC: 1` request became a real 404 on the document request. The one-reload bound was spent\n // on a recovery that worked and has to be released — otherwise the *next* soft navigation to this URL sees a\n // spent key and paints {@link showLateNotFound} over a page the app can still render.\n //\n // This is the discriminator the bound was missing. A structurally late `notFound()` commits its 200 before\n // it signals, so its reloaded document is the page itself and carries no `notFound`: the key survives and\n // that loop stays bounded at one reload, which is the whole reason the bound exists.\n if (initialPayload.notFound) {\n try {\n sessionStorage.removeItem(lateNotFoundKey());\n } catch {\n // Blocked site data. `reloadOnceForLateNotFound` already treats that as the terminating case.\n }\n }\n\n // Everything the last document saved, read before any payload commits: the in-memory map alone would not\n // survive the reload that `history.scrollRestoration = 'manual'` just stopped the browser restoring. The\n // entry's key is stable across a reload, and the offset is applied by `BrowserRoot`'s first layout effect,\n // before the first paint of the new tree.\n if (canSoftNavigate) readStoredScrollPositions();\n const restored = scrollPointFor(currentEntryKey());\n\n /**\n * Creates a one-shot completion for this render. Superseding it releases its waiter without\n * running scroll/focus work; committing runs that work before the browser paints; failing\n * releases the waiter with the reason the render never will do either.\n */\n function createRender(payload: RscPayload, href: string, afterCommit?: () => void, recoversByLoad = true): RenderRecord {\n const { promise, resolve, reject } = Promise.withResolvers<void>();\n let finished = false;\n return {\n payload,\n href,\n recoversByLoad,\n committed: promise,\n commit: () => {\n if (finished) return;\n finished = true;\n afterCommit?.();\n resolve();\n },\n // Supersession releases the old waiter, but never runs its scroll/focus callback.\n supersede: () => {\n finished = true;\n resolve();\n },\n // React tore the tree down, so this render never commits. Rejecting is what settles the navigation's\n // `finished` and the prepared handler; see {@link pendingRender}.\n fail: (error: unknown) => {\n if (finished) return;\n finished = true;\n reject(error);\n },\n };\n }\n\n const initialRender = createRender(initialPayload, documentUrl(), restored ? () => scrollToPoint(restored) : undefined);\n\n function BrowserRoot() {\n const [payload, setPayloadState] = React.useState(initialPayload);\n const [pending, startTransition] = useNavigationTransition(payload, restoreCommittedPayload);\n // The payload the last `setPayload` put on screen or on its way there, so `reapplyPayload` re-renders\n // that one rather than a payload a later navigation or action has already replaced.\n const currentPayload = React.useRef<RscPayload>(initialPayload);\n const [renders] = React.useState(() => new WeakMap<RscPayload, RenderRecord>([[initialPayload, initialRender]]));\n const scheduledRender = React.useRef(initialRender);\n const [revision, reviseCommit] = React.useState(0);\n\n React.useLayoutEffect(() => {\n setPayload = (next, afterCommit, { recoversByLoad = true } = {}) => {\n const scheduled = createRender(next, documentUrl(), afterCommit, recoversByLoad);\n scheduledRender.current.supersede();\n scheduledRender.current = scheduled;\n currentPayload.current = next;\n renders.set(next, scheduled);\n pendingRender = scheduled;\n setPayloadState(next);\n // A restoration to the same payload still owns a new commit and post-commit callback.\n reviseCommit((value) => value + 1);\n return scheduled.committed;\n };\n reapplyPayload = () => {\n setPayloadState(currentPayload.current);\n reviseCommit((value) => value + 1);\n };\n startNav = (run) => startTransition(run);\n }, [renders, startTransition]);\n\n React.useLayoutEffect(() => {\n const render = renders.get(payload);\n if (!render) return;\n renderedUrl = render.href;\n renderedModel = payload;\n // Only this render's own completion clears it: an older record can commit late (a re-apply or a bailed\n // transition), and it must not drop the newer render `onUncaughtError` would have to fail.\n if (pendingRender === render) pendingRender = undefined;\n render.commit();\n navigationFetches = navigationFetches.filter((fetch) => {\n if (fetch.navigation >= currentNavigation || navigationModels.get(fetch.controller) === payload) return true;\n fetch.controller.abort();\n return false;\n });\n }, [payload, revision, renders]);\n\n // A descendant may navigate from its first passive effect. Intercept it before that effect runs.\n React.useLayoutEffect(() => listenNavigation(), []);\n\n const preparing = useNavigationPreparation();\n const router = React.useMemo<NavigationRouter>(\n () => ({ push, replace, back, forward, refresh, pending: pending || preparing }),\n [pending, preparing],\n );\n\n return <RouterContext.Provider value={router}>{payload.root}</RouterContext.Provider>;\n }\n\n setServerCallback(async (id, args) => {\n const temporaryReferences = createTemporaryReferenceSet();\n // The document the action is being called from. Every action response carries a fresh payload for that\n // page, so if a navigation has moved on by the time it arrives the payload describes a page the user has\n // left — the return value is still theirs, but painting it is not. Compared without the fragment, which\n // the server never saw.\n const calledFrom = documentUrl();\n const request = createRscRequest(window.location.href, {\n id,\n body: await encodeReply(args, { temporaryReferences }),\n });\n let payload: RscPayload;\n try {\n payload = await createFromFetch<RscPayload>(payloadResponse(request), { temporaryReferences });\n if (documentUrl() === calledFrom) cancelNavigationPreparation();\n } catch (error) {\n // The current entry is the page the action was called from, not a redirecting one, so its redirect\n // pushes the target after it — the entry a Back is owed is the page that submitted the form.\n if (handleControlDigest(error, { history: 'push' })) return undefined;\n throw error;\n }\n if (payload.redirect) {\n void push(payload.redirect);\n return undefined;\n }\n if (documentUrl() === calledFrom) {\n // An action response contains the page after the mutation. Any older navigation snapshot must\n // lose ownership before it can replace that newer data. Applied streams stay alive until commit.\n const actionGeneration = ++currentNavigation;\n rejectAttempt(activeAttempt, new DOMException('Navigation superseded by server action', 'AbortError'));\n abortNavigationFetches((fetch) => !fetch.applied);\n React.startTransition(() => {\n const committed = setPayload(payload, undefined, { recoversByLoad: false });\n void committed.then(\n () => {\n abortNavigationFetches((fetch) => fetch.navigation < actionGeneration);\n },\n // An action reply that tears the tree down has no caller awaiting the commit, so the rejection is\n // consumed here rather than left unhandled. The panel `onUncaughtError` painted is the recovery:\n // the page a document load would render does not re-run the action that failed.\n () => {},\n );\n });\n }\n if (payload.notFound) return undefined;\n const result = payload.returnValue;\n if (!result) {\n // A payload that is not this action's own reply: the server rendered a page in its place. An action\n // that had already run has its result carried across (see `actionResults` in entry.rsc.tsx), and the\n // ways a *caller* can get a request wrong are refused ahead of any render — an unknown id or an\n // undecodable body is a `text/plain` 400, which `payloadResponse` turns into an error of its own\n // before this.\n //\n // What is left is the server failing before the action ran, which is answered with the `error` page —\n // a flight payload, so it arrives here rather than at `payloadResponse`, with no `returnValue` in it.\n // A module the deployment no longer holds is the reachable case: `loadServerAction` throws, the\n // framework reports it and 500s, and this is what the caller has to go on. Hence the message: the\n // failure is on the server and its log is where the error is. Below that it is still the defensive\n // floor for a payload shaped by another deployment or replaced by a proxy — reading `.ok` off it used\n // to hand the caller `Cannot read properties of undefined`.\n throw new Error(\n '[rshono] the server action produced no result — the request failed around it and the server answered with a page instead. Its log has the error.',\n );\n }\n if (!result.ok) throw result.error;\n return result.value;\n });\n\n // A `redirect()` / `notFound()` from a component below the page root reaches us through React: it rides the\n // flight payload as an error, and boundaries re-throw it so it lands here rather than in a fallback.\n //\n // Installing these hooks opts out of React's own defaults, so everything that isn't a control signal has to\n // be put back by hand — `reportError` rather than a bare log, so error-reporting tools still see it.\n hydrateRoot(document, <BrowserRoot />, {\n formState: initialPayload.formState,\n onCaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true, history: controlDigestHistory() })) return;\n // A boundary handled it and the tree is intact, so no overlay over the app's own fallback.\n console.error(error, errorInfo.componentStack ?? '');\n },\n onUncaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true, history: controlDigestHistory() })) return;\n // Nothing caught it, so React tears the root down — and the root is `document`.\n globalThis.reportError(error);\n const recover = pendingRender;\n // A navigation payload is the case a document load can still repair: the URL already names its\n // destination, and the server answers that document request with the app's error page. An action reply\n // is not — a GET of the URL it was called from does not re-run the action, so the page would render as\n // if nothing had happened and the load would silently discard the error. The panel is the answer, and it\n // is painted now because no load is coming to replace it. See {@link pendingRender}.\n if (!recover?.recoversByLoad) {\n showFatal(error, errorInfo.componentStack);\n recover?.fail(error);\n return;\n }\n // The panel waits for that load to arrive. Painted now, it flashes over the error page on its way and\n // vanishes when the page commits; the timer dies with the document a successful load replaces, so the\n // panel only appears when the recovery was never made. A render React is only suspending is not failed;\n // see {@link pendingRender}.\n setTimeout(() => showFatal(error, errorInfo.componentStack), RECOVERY_GRACE_MS);\n recover.fail(error);\n },\n });\n\n if (import.meta.webpackHot) {\n initDevRefresh();\n }\n}\n\n/**\n * Dev-only refresh client, listening to the CLI's SSE endpoint:\n *\n * client-built → hot-apply the waiting updates; anything the page can't be patched up to reloads.\n * rsc-update → server component code changed: re-fetch the flight payload, state preserved.\n * hello → sent on (re)connect with the latest build hash; a mismatch means a missed event.\n */\nfunction initDevRefresh() {\n const hot = import.meta.webpackHot!;\n let connectedOnce = false;\n /** The newest build the dev server has announced — what {@link applyClientUpdate} walks towards. */\n let targetHash: string | undefined;\n\n function reload(reason: string, error?: unknown): void {\n console.warn(`[rshono] ${reason} — reloading`, ...(error === undefined ? [] : [error]));\n loadDocument();\n }\n\n async function applyClientUpdate(): Promise<void> {\n const giveUp = await walkHotUpdates(\n hot,\n () => __webpack_hash__,\n () => targetHash,\n );\n if (giveUp) reload(giveUp.reason, giveUp.error);\n }\n\n async function handle(message: DevMessage): Promise<void> {\n switch (message.type) {\n case 'hello':\n targetHash = message.hash ?? targetHash;\n if (connectedOnce) {\n await applyClientUpdate();\n await loadPayload(window.location.href).catch(() => loadDocument());\n }\n connectedOnce = true;\n break;\n case 'client-built':\n targetHash = message.hash;\n await applyClientUpdate();\n break;\n case 'rsc-update':\n console.log('[rshono] server components updated');\n await loadPayload(window.location.href).catch(() => loadDocument());\n break;\n }\n }\n\n const source = new EventSource('/_rshono/hmr');\n // Chained rather than handled as they arrive: `hot.check` may only run from `idle`, and a burst of saves\n // puts several frames on the wire inside the time one takes. Queueing drops nothing, because `targetHash`\n // is shared — whichever handler runs next walks to the newest build.\n let queue: Promise<void> = Promise.resolve();\n source.onmessage = (event: MessageEvent<string>) => {\n const message = JSON.parse(event.data) as DevMessage;\n queue = queue.then(() => handle(message)).catch((error) => reload('the dev client failed', error));\n };\n}\n\n// A bootstrap failure — a truncated initial payload, most likely — would otherwise be an unhandled\n// rejection: nothing hydrates, nothing is reported, and the page just sits there.\nmain().catch((error) => {\n console.error('[rshono] the client runtime failed to start:', error);\n showFatal(error);\n});\n"]}
|
|
@@ -171,6 +171,22 @@ function refusesCrossSiteForm(c) {
|
|
|
171
171
|
function acceptsHtml(c) {
|
|
172
172
|
return c.req.header('accept')?.includes('text/html') ?? false;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The `Vary` a page-URL answer owes: one URL serves a document and a flight payload, so a cache — the
|
|
176
|
+
* shared one above all — has to key on `RSC` to tell them apart.
|
|
177
|
+
*
|
|
178
|
+
* Merged with whatever the app's own middleware prepared rather than written as a bare `RSC`, because a
|
|
179
|
+
* header bag passed to `c.body(...)` is applied *over* the prepared headers: a `vary` key in it replaces
|
|
180
|
+
* instead of extending, and an app varying on `Accept-Language`, a cookie or a feature flag would silently
|
|
181
|
+
* lose it — the plain-set mistake {@link varyWith} exists to prevent, reached through the bag rather than
|
|
182
|
+
* through `Headers.set`. The response floor merges the same way, but only for the two page content types it
|
|
183
|
+
* decorates; this is for the answers it deliberately leaves alone. `null` from {@link varyWith} means the
|
|
184
|
+
* prepared value already covers `RSC` (or is `*`), so it is kept as written rather than replaced by `RSC`.
|
|
185
|
+
*/
|
|
186
|
+
function rscVary(c) {
|
|
187
|
+
const existing = c.res.headers.get('vary');
|
|
188
|
+
return existing === null ? RSC_VARY_HEADER : (varyWith(existing, RSC_VARY_HEADER) ?? existing);
|
|
189
|
+
}
|
|
174
190
|
/**
|
|
175
191
|
* Every plain-text answer the framework gives on a page route: the 404s, the refusals on the action path and
|
|
176
192
|
* the last-resort 500. One function, because the header bag is what gets forgotten — and the four call sites
|
|
@@ -184,11 +200,11 @@ function acceptsHtml(c) {
|
|
|
184
200
|
* 404 beside it, the same answer to the same request from a client that asked for HTML, is correctly
|
|
185
201
|
* private. The action refusals answer a POST, which no cache stores, and 400/403/500 are not in that list
|
|
186
202
|
* either; saying it anyway costs a header and settles the question for good.
|
|
187
|
-
* - **`vary
|
|
188
|
-
*
|
|
203
|
+
* - **`vary`** because a page URL has two representations, and every one of these is an answer to a request
|
|
204
|
+
* that could have asked for either. Merged, never replaced — see {@link rscVary}.
|
|
189
205
|
*/
|
|
190
206
|
function plainRefusal(c, message, status) {
|
|
191
|
-
return c.text(message, status, { vary:
|
|
207
|
+
return c.text(message, status, { vary: rscVary(c), 'cache-control': PAGE_CACHE_CONTROL });
|
|
192
208
|
}
|
|
193
209
|
/**
|
|
194
210
|
* The 404 for an app with no `notFound` page, and for a client that wanted neither HTML nor a flight payload.
|
|
@@ -798,7 +814,11 @@ function buildApp() {
|
|
|
798
814
|
// recurses exactly once.
|
|
799
815
|
if (error instanceof RedirectSignal)
|
|
800
816
|
return respondToControlSignal(c, error);
|
|
801
|
-
|
|
817
|
+
// The client leaving is not the `notFound` page failing: the render it abandons rejects with the
|
|
818
|
+
// abort as its reason, and this page's own catch would otherwise report it — and render the page
|
|
819
|
+
// again — for a request that has nowhere left to send it. Same call as the top-level handler's.
|
|
820
|
+
if (!c.req.raw.signal.aborted)
|
|
821
|
+
reportServerError(error, { source: 'render', hono: c, message: '[rshono] the notFound page failed to render:' });
|
|
802
822
|
}
|
|
803
823
|
}
|
|
804
824
|
return plainNotFound(c);
|
|
@@ -828,7 +848,7 @@ function buildApp() {
|
|
|
828
848
|
const headers = {
|
|
829
849
|
'cache-control': SSG_CACHE_CONTROL,
|
|
830
850
|
etag: page.etag,
|
|
831
|
-
vary:
|
|
851
|
+
vary: rscVary(c),
|
|
832
852
|
'content-type': isRsc ? 'text/x-component;charset=utf-8' : 'text/html;charset=utf-8',
|
|
833
853
|
};
|
|
834
854
|
if (etagMatches(c.req.header('if-none-match'), page.etag))
|
|
@@ -916,8 +936,16 @@ function buildApp() {
|
|
|
916
936
|
const res = error.getResponse();
|
|
917
937
|
return c.newResponse(res.body, res);
|
|
918
938
|
}
|
|
919
|
-
//
|
|
920
|
-
|
|
939
|
+
// `cameFromPayload` first: a shell failure re-thrown from `renderComponent` was reported by the stage
|
|
940
|
+
// that recognised it, and is not this handler's to report again.
|
|
941
|
+
//
|
|
942
|
+
// Then the abort. A client that has already gone is not the app being wrong, and every render it touches
|
|
943
|
+
// rejects with the abort — the same call `entry.ssr.tsx`'s `onError` and the RSC handler above make.
|
|
944
|
+
// Without this a disconnect was the one thing reported, as `[rshono] request error: ... aborted`, and the
|
|
945
|
+
// error page was rendered for nobody. This sample answers only for the report *here*: the error page's
|
|
946
|
+
// own catch reads the signal again, because that render starts later and the client can leave in between.
|
|
947
|
+
const clientGone = c.req.raw.signal.aborted;
|
|
948
|
+
if (!cameFromPayload(error) && !clientGone)
|
|
921
949
|
reportServerError(error, { source: 'request', hono: c, message: '[rshono] request error:' });
|
|
922
950
|
const isRsc = requestWantsRsc(c.req.raw);
|
|
923
951
|
if (loadErrorPage && (isRsc || acceptsHtml(c))) {
|
|
@@ -951,9 +979,13 @@ function buildApp() {
|
|
|
951
979
|
// already reported as `render` by the render that produced it. So the line still goes to stderr —
|
|
952
980
|
// with two `render` reports on one request it is what says which of them was the error page — but
|
|
953
981
|
// it is not a second report of one fault. {@link cameFromPayload}.
|
|
982
|
+
//
|
|
983
|
+
// The signal is read here rather than reusing the sample above: this render started after that one
|
|
984
|
+
// was taken, and a client that left while it was running rejects it with the same abort. Reporting
|
|
985
|
+
// that would be the very disconnect noise the check above exists to keep out.
|
|
954
986
|
if (cameFromPayload(renderError))
|
|
955
987
|
console.error(message, renderError);
|
|
956
|
-
else
|
|
988
|
+
else if (!c.req.raw.signal.aborted)
|
|
957
989
|
reportServerError(renderError, { source: 'request', hono: c, message });
|
|
958
990
|
}
|
|
959
991
|
}
|
|
@@ -962,7 +994,7 @@ function buildApp() {
|
|
|
962
994
|
// either case shows a bare line of text where the app used to show a page. Everything else — a flight
|
|
963
995
|
// fetch, curl, a probe — gets the plain line, which is what it asked for.
|
|
964
996
|
if (!isRsc && acceptsHtml(c)) {
|
|
965
|
-
return c.html(failureDocument(error), 500, { vary:
|
|
997
|
+
return c.html(failureDocument(error), 500, { vary: rscVary(c), 'cache-control': PAGE_CACHE_CONTROL });
|
|
966
998
|
}
|
|
967
999
|
const detail = isDev ? `\n\n${error instanceof Error ? (error.stack ?? error.message) : String(error)}` : '';
|
|
968
1000
|
return plainRefusal(c, `Internal Server Error${detail}`, 500);
|