@rsc-kit/core 0.20.3 → 0.20.5
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/dist/earlyHints.d.ts +17 -0
- package/dist/earlyHints.js +65 -0
- package/dist/earlyHints.js.map +1 -0
- package/dist/host.d.ts +3 -0
- package/dist/host.js +31 -1
- package/dist/host.js.map +1 -1
- package/dist/js/Link.js +1 -1
- package/dist/js/Link.js.map +1 -1
- package/dist/js/PathnameProvider.js +14 -1
- package/dist/js/PathnameProvider.js.map +1 -1
- package/dist/js/createViteRscApp.js +6 -0
- package/dist/js/createViteRscApp.js.map +1 -1
- package/dist/js/earlyClicks.d.ts +35 -0
- package/dist/js/earlyClicks.js +67 -0
- package/dist/js/earlyClicks.js.map +1 -0
- package/dist/js/navigate.js +95 -11
- package/dist/js/navigate.js.map +1 -1
- package/dist/js/updateStore.d.ts +6 -0
- package/dist/js/updateStore.js +48 -2
- package/dist/js/updateStore.js.map +1 -1
- package/dist/vite.js +113 -11
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
package/dist/js/navigate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate.js","sourceRoot":"","sources":["../../src/js/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAClD,6EAA6E;AAC7E,qDAAqD;AACrD,OAAO,EACL,UAAU,EACV,YAAY,IAAI,eAAe,EAC/B,WAAW,GACZ,MAAM,YAAY,CAAC;AAyDpB,IAAI,OAAO,GAAG,EAAE,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CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,aAAa,CAAC,GAAG,CAAC;QAAE,OAAO;IAE/B,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAErD,IAAI,CAAC,UAAU;QAAE,OAAO;IAExB,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvB,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Core SPA navigation engine for RSC.\n *\n * Uses module-level state (singleton in the browser bundle).\n * The Flight deserializer is injected by createViteRscApp to avoid\n * duplicate bundling of react-server-dom-webpack.\n */\n\nimport { isStaleAssetError, loadDocumentOnce } from \"./staleAssets\";\nimport { isUpdated } from \"./updateStore\";\nimport { isSafeRedirect } from \"../safeUrl.js\";\nimport type { Route } from \"../routes.js\";\nimport { reportReachable } from \"./onlineStore\";\nimport { clearSlots, setSlot } from \"./slotStore\";\n// Shared with the host: it stores a page under this key and the client looks\n// under it, so the format cannot live in two places.\nimport {\n matchRoute,\n retentionKey as retentionKeyFor,\n sharedDepth,\n} from \"../routing\";\nimport type { ManifestRoute } from \"../manifest\";\n\ntype ReactNode = unknown;\ntype Deserializer = (\n stream: ReadableStream,\n options: Record<string, unknown>,\n) => Promise<ReactNode>;\ntype CallServerFn = (id: string, args: unknown[]) => Promise<unknown>;\n\ninterface CacheEntry {\n tree: Promise<ReactNode>;\n expiresAt: number;\n /**\n * What the server said about the payload. A prefetch is a real request, so\n * it comes back partial like any other — losing that and treating it as a\n * whole document replaces the root with a page that has no layouts.\n */\n segmentDepth: number;\n layouts: string[] | null;\n /**\n * The slot this payload fills, when it is one region rather than a segment.\n *\n * A prefetch is a real request and comes back as whatever the host answers.\n * An interception answers with the interceptor alone, and an entry that\n * forgets that is applied as a whole document — so a hovered modal link\n * renders the modal *as* the page, with nothing around it. Only after a\n * hover, which is why a scripted click never finds it.\n */\n slot: string | null;\n /**\n * The chain held when this was prefetched. A partial payload is only valid\n * against the chain it was rendered for; navigate somewhere else first and\n * it no longer composes.\n */\n heldWhenFetched: string;\n /**\n * Where the prefetch was sent instead, when the host answered a redirect.\n * The entry leaves the cache - a hover must not navigate - but a click\n * that took the entry while the request was in flight awaits its tree, and\n * a tree of null committed as the page was the whole document gone: url\n * changed, root unmounted, nothing in the console. On a phone the tap's\n * touchstart prefetches with no delay and the click lands 100-300 ms\n * later, the length of a round trip, so a tapped link to a guarded page\n * blanked the page about half the time. The navigation reads this and\n * follows it, the way it follows a redirect on its own request.\n */\n redirectTo: string | null;\n /** The request failed or was aborted; a navigation that took the entry asks again. */\n failed: boolean;\n}\n\ninterface InterceptEntry {\n urlPattern: string;\n slot: string;\n}\n\nlet version = \"\";\nlet onNavigate:\n ((tree: ReactNode, key: string, segmentDepth: number) => void) | null = null;\nlet onRestore: ((key: string, maxAge?: number) => boolean) | null = null;\n\n/**\n * How stale a held page may be and still be revealed by a link.\n *\n * The back button ignores this: it names a moment, and the page from that\n * moment is the right answer however old. A link says \"go here\", so there is a\n * point past which answering with what you saw before is stale data presented\n * as fresh. Thirty seconds covers leaving a form to check something and coming\n * straight back, which is the case this exists for.\n */\nlet revealWithin = 30_000;\n\nexport function setRevealWindow(ms: number): void {\n revealWithin = ms;\n}\nlet flightDeserializer: Deserializer | null = null;\nlet callServerFn: CallServerFn | null = null;\nlet activeController: AbortController | null = null;\nconst cache = new Map<string, CacheEntry>();\n/** In-flight prefetches, so one the pointer moved away from can be dropped. */\nconst prefetchControllers = new Map<string, AbortController>();\nlet interceptManifest: InterceptEntry[] = [];\n\n// The layout chain currently mounted, outermost first. Sent so the server can\n// skip re-rendering the layouts still on screen.\nlet heldLayouts: string[] = [];\n\n/**\n * The boundary depth an interception was rendered at, while one is showing.\n *\n * An interceptor replaces a slot on the layout that declares it, so leaving the\n * intercepted view has to re-render that layout for the slot to go back to its\n * default. Left to itself the next navigation shares the whole chain, replaces\n * only the page below it, and the modal stays open over the new one.\n */\nlet interceptedAtDepth: number | null = null;\n\n/**\n * The url showing underneath an open interception.\n *\n * An interception puts something in a slot on a page that stays where it is,\n * so closing it is not a navigation at all — the page beneath was never\n * replaced. Remembering which url that is means going back to it costs\n * nothing, rather than fetching and rebuilding a page that is already on\n * screen with everything the user typed into it.\n */\nlet interceptedOver: string | null = null;\n\nconst DEFAULT_PREFETCH_TTL = 30_000;\n\n/**\n * How many prefetched payloads are kept. Entries carry a TTL but were only\n * dropped when read again, so a long session hovering its way through a big\n * nav held every payload it had ever fetched. On insert, anything expired\n * goes, and past the cap the oldest goes - insertion order is age.\n */\nconst MAX_CACHED = 50;\n\nfunction makeRoom(): void {\n const now = Date.now();\n\n for (const [key, entry] of cache) {\n if (entry.expiresAt <= now && !prefetchControllers.has(key))\n cache.delete(key);\n }\n\n while (cache.size >= MAX_CACHED) {\n const oldest = cache.keys().next().value as string | undefined;\n\n if (oldest === undefined) break;\n\n prefetchControllers.get(oldest)?.abort();\n prefetchControllers.delete(oldest);\n cache.delete(oldest);\n }\n}\n\n/**\n * Where a payload lives when there is no server to negotiate with.\n *\n * Normally the payload and the page share a url and are told apart by the\n * X-RSC header. A static host cannot vary by header — it serves one file per\n * url — so an exported build gives payloads their own addresses and the client\n * asks for those instead.\n */\nlet staticPayloadSuffix: string | null = null;\n\n/**\n * The route table, on a static host only.\n *\n * A server works out how much of the page to send by comparing the chain the\n * client sent with the route's own, and says so in a header. A file server\n * does neither — so on an exported site the client has to know the target's\n * layout chain before it asks, or every navigation takes the whole document\n * and replaces the root, which unmounts everything retained behind it.\n *\n * Inlined into the browser entry by the build, so it costs no request.\n */\nlet staticRoutes: ManifestRoute[] | null = null;\n\nexport function setStaticRoutes(routes: ManifestRoute[]): void {\n staticRoutes = routes;\n}\n\n/**\n * The layout chain of the page loaded from a file, since no header said.\n *\n * Without this the client believes it holds nothing, every navigation asks\n * for a whole document, and the depth variants sitting beside it are never\n * requested — the export looks correct and retention silently never happens.\n */\nexport function seedStaticChain(url: string): boolean {\n const segments = staticSegments(url);\n\n if (!segments) return false;\n\n heldLayouts = segments.chain;\n\n return true;\n}\n\n/**\n * The depth an exported payload should be asked for, and the chain it leaves\n * mounted — the two things a header would otherwise have carried.\n */\nfunction staticSegments(\n url: string,\n held: string[] = heldLayouts,\n): { depth: number; chain: string[] } | null {\n if (staticRoutes === null) return null;\n\n const path = new URL(url, window.location.origin).pathname;\n const match = matchRoute({ routes: staticRoutes } as never, path);\n\n if (!match) return null;\n\n return {\n // Against the chain the request is made with, never against whatever is\n // mounted by the time the answer arrives. A prefetch is fetched against\n // one chain and applied later, and reading live state here labels its\n // payload with a depth it was not rendered for.\n depth: sharedDepth(held.join(\",\"), match.route.layouts),\n // Copied: this is the build's table, and the caller assigns it to the\n // chain it holds — handing out the array itself makes the two the same\n // object.\n chain: [...match.route.layouts],\n };\n}\n\nexport function setStaticPayloads(suffix: string | null): void {\n staticPayloadSuffix = suffix;\n}\n\n/** The url to request a payload from, which is the page's own unless exported. */\nexport function payloadUrl(url: string, held: string[] = heldLayouts): string {\n if (staticPayloadSuffix === null) return url;\n\n const parsed = new URL(url, window.location.origin);\n const path = parsed.pathname.replace(/\\/+$/, \"\");\n const segments = staticSegments(url, held);\n\n // The variant for exactly the depth this client shares. Asking for the whole\n // document when a segment would do is not merely wasteful: it replaces the\n // root, and replacing the root throws away every page retained behind it.\n const name =\n segments && segments.depth > 0\n ? staticPayloadSuffix.replace(/^index\\./, `index.seg${segments.depth}.`)\n : staticPayloadSuffix;\n\n return `${path}/${name}${parsed.search}`;\n}\n\n/**\n * What a static payload was fetched as, recorded against its own response.\n *\n * The depth asked for and the depth applied have to be the same number. Worked\n * out separately at the two call sites they can disagree — and a payload\n * rendered whole but applied as a segment nests a boundary inside itself,\n * which does not error, it recurses until the renderer stops responding.\n */\nconst staticFetches = new WeakMap<\n Response,\n { depth: number; chain: string[] }\n>();\n\nexport function setVersion(v: string): void {\n version = v;\n}\n\n/**\n * The layout chain the client is holding.\n *\n * Seeded from the initial page's response and updated on every navigation, so\n * the next request can say what is already mounted.\n */\nexport function setHeldLayouts(chain: string[]): void {\n heldLayouts = chain;\n}\n\nexport function getHeldLayouts(): string[] {\n return heldLayouts;\n}\n\nexport function setNavigateHandler(\n fn: (tree: ReactNode, key: string, segmentDepth: number) => void,\n): void {\n onNavigate = fn;\n}\n\n/**\n * How the router reveals a page that is still mounted behind the current one.\n *\n * Returning true means the page was restored with its client state intact and\n * no request was made.\n */\nexport function setRestoreHandler(\n fn: (key: string, maxAge?: number) => boolean,\n): void {\n onRestore = fn;\n}\n\nexport function setDeserializer(fn: Deserializer): void {\n flightDeserializer = fn;\n}\n\nexport function setCallServer(fn: CallServerFn): void {\n callServerFn = fn;\n}\n\n/**\n * The urls a route.ts answers, so a link to one is treated as the anchor it\n * is: no prefetch - a hover must not run a route - and a full navigation\n * rather than a payload fetch, since the answer is a Response, not a page.\n * Baked into the generated browser entry from the route tree.\n */\nlet apiRoutePatterns: RegExp[] = [];\n\nexport function setApiRoutes(patterns: string[]): void {\n apiRoutePatterns = patterns.map(\n (pattern) =>\n new RegExp(\n \"^\" +\n pattern\n .split(\"/\")\n .map((part) =>\n part.startsWith(\"[...\") ? \".+\" : part.startsWith(\"[\") ? \"[^/]+\" : part.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"),\n )\n .join(\"/\") +\n \"/?$\",\n ),\n );\n}\n\n/** Whether a url is one a route.ts answers. */\nexport function isApiRoute(url: string): boolean {\n if (apiRoutePatterns.length === 0) return false;\n\n try {\n const { pathname } = new URL(url, window.location.origin);\n\n return apiRoutePatterns.some((pattern) => pattern.test(pathname));\n } catch {\n return false;\n }\n}\n\nexport function setInterceptManifest(entries: InterceptEntry[]): void {\n interceptManifest = entries;\n}\n\n/**\n * Check if a URL matches any intercept pattern.\n * Returns the matching slot name, or null if no match.\n */\nfunction matchIntercept(url: string): string | null {\n if (interceptManifest.length === 0) return null;\n\n let pathname: string;\n try {\n pathname = new URL(url, window.location.origin).pathname;\n } catch {\n pathname = url.split(\"?\")[0];\n }\n\n for (const entry of interceptManifest) {\n // urlPattern already has a leading slash (e.g. \"/docs/item/[id]\")\n const regex = new RegExp(\n \"^\" +\n entry.urlPattern\n .replace(/\\[\\.\\.\\.(\\w+)\\]/g, \"(.+)\")\n .replace(/\\[(\\w+)\\]/g, \"([^/]+)\") +\n \"$\",\n );\n\n if (regex.test(pathname)) {\n return entry.slot;\n }\n }\n\n return null;\n}\n\nexport function renderTree(tree: ReactNode): void {\n onNavigate?.(tree, retentionKey(window.location.href, null), 0);\n}\n\n/**\n * Identity of a page for retention purposes.\n *\n * Path and query only: a hash is a position within the same page, and an\n * intercepted route is a different rendering of the same URL, so it retains\n * separately from the full page.\n */\nexport function retentionKey(\n url: string,\n interceptSlot: string | null,\n): string {\n let path: string;\n\n try {\n const parsed = new URL(url, window.location.origin);\n path = parsed.pathname + parsed.search;\n } catch {\n path = url.split(\"#\")[0];\n }\n\n return retentionKeyFor(path, interceptSlot);\n}\n\nexport function getCallServer(): CallServerFn {\n if (!callServerFn) {\n throw new Error(\n \"callServer not initialized. Ensure createViteRscApp() has been called.\",\n );\n }\n return callServerFn;\n}\n\nfunction fetchRscPayload(\n url: string,\n signal?: AbortSignal,\n interceptSlot?: string,\n refererUrl?: string,\n chain: string[] = heldLayouts,\n // A prefetch is speculative and a navigation is not, but on the wire they\n // were identical — so a click could queue behind several prefetches the user\n // had already moved past. Over HTTP/1.1 a browser opens ~6 connections per\n // origin, which a sweep across a nav bar fills on its own.\n priority: \"high\" | \"low\" = \"high\",\n): Promise<Response> {\n const headers: Record<string, string> = {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n };\n\n if (chain.length) {\n headers[\"X-RSC-Segments\"] = chain.join(\",\");\n }\n\n if (interceptSlot) {\n headers[\"X-RSC-Intercept\"] = interceptSlot;\n }\n\n if (refererUrl) {\n headers[\"X-RSC-Referer\"] = refererUrl;\n }\n\n // `priority` is not in every lib.dom yet; browsers without it ignore it.\n const asked = staticSegments(url, chain);\n const request = fetch(payloadUrl(url, chain), {\n headers,\n signal,\n priority,\n } as RequestInit).catch((err: unknown) => {\n // Nothing answered at all. An abort is our own doing, not the network's —\n // leaving a link cancels its prefetch, and that must not read as offline.\n if (!(err instanceof DOMException && err.name === \"AbortError\")) {\n reportReachable(false);\n }\n\n throw err;\n });\n\n return request.then(async (response) => {\n // What this payload was asked for, so the apply side cannot work out a\n // different answer from state that has moved on since.\n if (asked) staticFetches.set(response, asked);\n\n // Something answered, whatever it said. A 500 is a reachable server.\n reportReachable(true);\n // Adopt the server's build version from the first response that carries\n // one. Until we know it we send an empty version, which the middleware\n // treats as \"no opinion\"; afterwards a redeploy mid-session answers 409.\n const served = response.headers.get(\"X-RSC-Version\");\n\n if (served && version === \"\") {\n version = served;\n }\n\n if (response.status === 409) {\n const location = response.headers.get(\"X-RSC-Location\");\n // Server-chosen, so checked again here: the engine refuses these at the\n // source, but a host in front of it can put anything on the header.\n // Once per url: a worker still serving the last build's document would\n // answer the load with it, and the next click would be here again.\n const to = isSafeRedirect(location ?? url) ? (location ?? url) : url;\n\n throw new Error(\n loadDocumentOnce(to)\n ? \"This page is from an earlier build; loading the document from the current one\"\n : \"This page is from an earlier build, and loading the document did not bring the current one\",\n );\n }\n\n return response;\n });\n}\n\n/**\n * Deserialize a Flight response into a React tree.\n *\n * Client modules, CSS <link>s and <title>/<meta> all travel inside the Flight\n * payload — @vitejs/plugin-rsc emits stylesheet links as tree elements and\n * resolves client references through its own browser runtime, and React 19\n * hoists document metadata into <head>. Nothing needs injecting from headers.\n */\nfunction deserializeResponse(response: Response): Promise<ReactNode> {\n return flightDeserializer!(response.body!, {\n callServer:\n callServerFn ??\n (async () => {\n throw new Error(\"Server actions not initialized\");\n }),\n });\n}\n\nfunction isExternalUrl(url: string): boolean {\n try {\n return (\n new URL(url, window.location.origin).origin !== window.location.origin\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a cached payload can be used for a navigation claiming this chain.\n *\n * A partial payload only composes against the chain it was rendered for, so\n * the chain it was fetched against has to be the one the navigation is about\n * to claim — not whatever happens to be mounted.\n */\nfunction isUsable(cached: CacheEntry | undefined, chain: string[]): boolean {\n return (\n cached !== undefined &&\n cached.expiresAt > Date.now() &&\n cached.heldWhenFetched === chain.join(\",\")\n );\n}\n\n/**\n * Whether a navigation to this url would be served from the prefetch cache.\n *\n * Lets a caller decide whether showing an already-fetched page is free. A form\n * uses it to put its target route's shell on screen while the real query runs:\n * worth doing when the shell is in hand, never worth an extra request.\n */\nexport function isPrefetched(url: string): boolean {\n if (isExternalUrl(url)) return false;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n return isUsable(cache.get(cacheKey), claimedChain(interceptSlot));\n}\n\n/**\n * The layout chain a navigation to a url will claim.\n *\n * Leaving an interception claims fewer layouts than are held, which is what\n * forces the layout owning the slot to render again so the slot can empty.\n * Both sides have to agree on it: a prefetch recorded against a different\n * chain can never be used, so the close of every modal refetched a payload it\n * had already fetched.\n */\nfunction claimedChain(interceptSlot: string | null): string[] {\n return !interceptSlot && interceptedAtDepth !== null\n ? heldLayouts.slice(0, interceptedAtDepth)\n : heldLayouts;\n}\n\n/**\n * How many redirects a single navigation will follow before giving up.\n *\n * A page that redirects to itself is a mistake someone will make, and without\n * a ceiling it is an unbounded loop of requests rather than an error. The\n * browser's own limit for HTTP redirects is 20; this is smaller because these\n * are full renders, not header exchanges.\n */\nconst MAX_REDIRECTS = 8;\n\n/**\n * Go to a url, the way a Link does.\n *\n * `url` is typed to the routes the build found; cast with `as Route` when the\n * destination is computed rather than written.\n */\nexport async function navigate(\n url: Route,\n opts?: {\n replace?: boolean;\n preserveScroll?: boolean;\n restore?: boolean;\n /** Internal: how many redirects led here. */\n redirectsFollowed?: number;\n },\n): Promise<void> {\n const redirectsFollowed = opts?.redirectsFollowed ?? 0;\n\n // The worker has said a newer build is live. This page's client cannot\n // load what that build's payloads name, so the next navigation is the\n // document, from the new build - the router knows; the banner was only\n // advice. Not for a restore: going back to a page still held asks the\n // server for nothing.\n if (!opts?.restore && isUpdated()) {\n window.location.href = url;\n\n return;\n }\n\n if (redirectsFollowed > MAX_REDIRECTS) {\n throw new Error(\n `Too many redirects following a navigation (${MAX_REDIRECTS}); last was ${url}`,\n );\n }\n\n // External URLs can't be fetched (CORS) — go directly to full page navigation\n if (isExternalUrl(url)) {\n window.location.href = url;\n return;\n }\n\n // A route.ts answers with a Response, not a page: a download, a redirect\n // that decides where someone belongs, a sign-out. The browser goes there.\n if (isApiRoute(url)) {\n window.location.href = url;\n return;\n }\n\n // Hash-only URLs — let the browser handle scrolling natively\n if (url.startsWith(\"#\")) {\n window.location.hash = url;\n return;\n }\n\n // Abort any in-flight navigation\n activeController?.abort();\n\n // Not window.stop(). It used to be called here while the document was\n // still loading, to free a single-threaded server for the new request -\n // and it cancels every load the page has in flight: the client chunks a\n // just-decoded tree still needs, the stylesheet, the boundaries still\n // streaming. A navigation that left the page before the runtime had\n // finished arriving rendered a document with nothing in it. The server\n // has workers; the page keeps loading.\n\n const controller = new AbortController();\n activeController = controller;\n\n // Check if this URL matches an intercept pattern.\n // If so, send the intercept slot + current URL as referer so the server\n // renders the full tree with the interceptor in the right slot.\n const interceptSlot = matchIntercept(url);\n const currentUrl = interceptSlot\n ? window.location.pathname + window.location.search\n : undefined;\n\n const activityKey = retentionKey(url, interceptSlot);\n\n // A page still being held is revealed rather than refetched, whichever\n // gesture asked for it — the back button or a link. Both mean \"the page I\n // was just on\", and having the form you were filling in survive one and not\n // the other is a distinction nobody makes while using the app.\n //\n // The cost is honest: what comes back is the tree from when you left, so its\n // data is from then. Retention is four pages deep, so this reaches only\n // somewhere you were moments ago, and `revalidate()` is how a page says its\n // data has moved on.\n // Closing an interception. The page underneath was never replaced, so this\n // is a matter of emptying the slot — no request, and nothing rebuilt. The\n // form behind the modal is still the one the user was filling in.\n if (\n !interceptSlot &&\n interceptedOver !== null &&\n retentionKey(url, null) === retentionKey(interceptedOver, null)\n ) {\n clearSlots();\n interceptedOver = null;\n interceptedAtDepth = null;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // Not when the target is the page already showing: asking for this page\n // again means asking the server again, and revealing what is already there\n // would make refresh a no-op. Not while an interception is opening or\n // closing either — those rebuild the chain deliberately.\n const askingForThisPage =\n retentionKey(window.location.href, null) === retentionKey(url, null);\n //\n // And not while an interception is on screen. Leaving a modal has to\n // re-render the layout that owns the slot, because that is what empties it;\n // revealing the page underneath instead leaves the modal sitting over a page\n // whose url has already changed.\n const mayReveal =\n opts?.restore === true ||\n (!askingForThisPage &&\n !interceptSlot &&\n interceptedOver === null &&\n interceptedAtDepth === null);\n\n // Unbounded for the back button, bounded for a link.\n if (\n mayReveal &&\n onRestore?.(activityKey, opts?.restore ? undefined : revealWithin)\n ) {\n // A restored tree carries its own slot contents, so the flag only has to\n // reflect whether what is now showing is an intercepted view.\n if (!interceptSlot) interceptedAtDepth = null;\n\n // opts?.replace, not opts.replace: this branch used to be reachable only\n // with opts.restore set, so opts was always there. A link reaches it now\n // with nothing passed at all.\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // A prefetched payload was rendered against the chain held at prefetch time.\n let segmentDepth = 0;\n let nextLayouts: string[] | null = null;\n /** The slot this answer fills, when it is one region rather than a segment. */\n let slotPayload: string | null = null;\n /** The cache entry this navigation is using, whose metadata settles with it. */\n let reused: CacheEntry | null = null;\n const previousUrl = window.location.pathname + window.location.search;\n\n try {\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const cached = cache.get(cacheKey);\n let treePromise: Promise<ReactNode>;\n\n const chain = claimedChain(interceptSlot);\n\n // A partial payload only composes against the chain it was rendered for —\n // the one this navigation is about to claim, not whatever is mounted.\n // Hovering a link inside a modal prefetches it against the full chain, so\n // reusing that here would skip the layout holding the modal and leave it\n // open over the page behind it.\n const usable = isUsable(cached, chain);\n\n if (usable) {\n treePromise = cached!.tree;\n // Read after the tree resolves, not now. A prefetch fills these in when\n // its response lands, and a click can land first — hover a modal link\n // and click it quickly and the entry still says depth 0, so the\n // interceptor is applied as a whole document and the modal renders *as*\n // the page. The fields are set before the tree promise resolves, so\n // waiting for it is what makes them true.\n reused = cached!;\n cache.delete(cacheKey);\n } else {\n cache.delete(cacheKey);\n\n const response = await fetchRscPayload(\n url,\n controller.signal,\n interceptSlot ?? undefined,\n currentUrl,\n chain,\n );\n\n // The check is for a host that answered the page instead of the\n // payload, which is what a server does when it does not recognise the\n // header. An exported build asks a url that only ever holds a payload,\n // and a file server labels it by extension — commonly\n // application/octet-stream — so the check would reject every navigation\n // and send the browser on a full page load instead.\n // The render asked to go somewhere else, and said so before writing\n // anything — so this is still a navigation, not a page load. A redirect\n // decided later than that cannot travel here; it arrives in the payload\n // as an error digest and RedirectBoundary performs it.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n // replace: the url that redirected never became a page the user was\n // on, so Back must not return to it and redirect again.\n // Chosen by the server, not written here.\n await navigate(redirectTo as Route, {\n replace: true,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n const contentType = response.headers.get(\"Content-Type\") ?? \"\";\n\n if (\n staticPayloadSuffix === null &&\n !contentType.includes(\"text/x-component\")\n ) {\n window.location.href = url;\n return;\n }\n\n // Headers on a server; worked out locally on a static host, where there\n // is nothing to send them.\n const served = staticFetches.get(response) ?? null;\n\n segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? served?.depth ?? 0,\n ) || 0;\n\n // Named region rather than a segment — see the apply below.\n slotPayload = response.headers.get(\"X-RSC-Revalidate\");\n\n const servedLayouts = response.headers.get(\"X-RSC-Layouts\");\n\n if (servedLayouts !== null) {\n nextLayouts = servedLayouts === \"\" ? [] : servedLayouts.split(\",\");\n } else if (served) {\n nextLayouts = served.chain;\n }\n\n treePromise = deserializeResponse(response);\n }\n\n let tree: ReactNode;\n\n try {\n tree = await treePromise;\n } catch (error) {\n // A navigation another one overtook: its request was aborted, and\n // the decoder reports that as a failure of the payload. It is not one\n // - nothing of it was going to be shown - so it ends here, quietly,\n // rather than as a rejection nobody is waiting on.\n if (controller.signal.aborted) return;\n\n throw error;\n }\n\n if (reused) {\n if (controller.signal.aborted) return;\n\n // The prefetch this navigation took did not come back as a page. A\n // redirect is followed as one on this request would be; a failure is\n // asked again, from a cache that no longer holds the entry.\n if (reused.redirectTo) {\n await navigate(reused.redirectTo as Route, {\n replace: true,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n if (reused.failed) {\n await navigate(url, opts);\n\n return;\n }\n\n segmentDepth = reused.segmentDepth;\n nextLayouts = reused.layouts;\n slotPayload = reused.slot;\n }\n\n if (controller.signal.aborted) return;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n if (nextLayouts !== null) heldLayouts = nextLayouts;\n\n // The answer is one region, not a piece of the page: the host rendered\n // only the interceptor because the page underneath is already mounted and\n // still correct. Putting it in the slot leaves that page — and everything\n // typed into it — exactly as it was.\n if (slotPayload !== null) {\n setSlot(slotPayload, tree as ReactNode);\n interceptedOver = interceptedOver ?? previousUrl;\n interceptedAtDepth = null;\n\n return;\n }\n\n // A slot rendered for the page being left has no claim on the one being\n // arrived at.\n clearSlots();\n\n interceptedOver = null;\n interceptedAtDepth = interceptSlot ? segmentDepth : null;\n\n onNavigate?.(tree, activityKey, segmentDepth);\n\n if (!opts?.preserveScroll && !interceptSlot) {\n // Wait for React to commit the DOM update before scrolling.\n // Intercepted navigations preserve scroll (e.g. modal over current page).\n requestAnimationFrame(() => {\n window.scrollTo(0, 0);\n });\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n } catch (err) {\n if (err instanceof DOMException && err.name === \"AbortError\") return;\n\n // A chunk the deploy no longer serves: the browser would have loaded the\n // document, and the new names with it. Do what it would have done.\n if (isStaleAssetError(err)) {\n window.location.href = url;\n\n return;\n }\n\n // Without this a navigation that fails does nothing observable: the click\n // clears its own pending state and the page stays as it was, with no\n // error, no fallback and nothing for an app to react to. Dispatched before\n // rethrowing, so a programmatic caller still sees the failure.\n window.dispatchEvent(\n new CustomEvent(\"rsc-navigate-error\", { detail: { url, error: err } }),\n );\n\n throw err;\n } finally {\n if (activeController === controller) {\n activeController = null;\n }\n }\n}\n\n/**\n * Put something the server re-rendered on screen.\n *\n * The trees arrive with an action's answer rather than being fetched, so this\n * is the same apply path a navigation uses — without a request, a url change\n * or a history entry.\n */\nexport function applyRevalidated(target: string, tree: ReactNode): void {\n const url = window.location.pathname + window.location.search;\n const key = retentionKey(url, null);\n\n if (target === \"all\") {\n // Depth 0 replaces the root, which is what re-rendering the layouts means.\n onNavigate?.(tree, key, 0);\n\n return;\n }\n\n if (target === \"page\") {\n onNavigate?.(tree, key, heldLayouts.length);\n\n return;\n }\n\n setSlot(target, tree);\n}\n\n/**\n * Ask the server for part of this page again.\n *\n * refresh() the page, leaving the layouts mounted\n * refresh('all') the whole document, layouts included\n * refresh('orders') one parallel slot, by the name its directory gave it\n *\n * The same words an action uses, so a thing can be invalidated from either\n * side. This is the path for a refresh nobody mutated anything to earn — a\n * button, a poll, a message saying that table has moved; what an action\n * invalidated travels back inside the action's own answer instead.\n *\n * A slot is the only region smaller than a page the server can name, so two\n * tables refresh apart from each other only if they are two slots. The page\n * form leaves the layouts alone, which is what makes it cheap and also why a\n * count living in a layout will not move until you ask for 'all'.\n */\nexport async function refresh(target = \"page\"): Promise<void> {\n const url = window.location.pathname + window.location.search;\n\n if (target !== \"page\" && target !== \"all\") {\n const response = await fetch(payloadUrl(url), {\n headers: {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n \"X-RSC-Revalidate\": target,\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Could not revalidate ${target}: the server answered ${response.status}`,\n );\n }\n\n setSlot(target, await deserializeResponse(response));\n\n return;\n }\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n // Never from the cache: refreshing asks what the server says now, not what\n // it said a moment ago.\n cache.delete(cacheKey);\n\n if (target === \"all\") {\n heldLayouts = [];\n }\n\n // A refresh is not a navigation: the same page stays under the reader, so\n // where they were reading has to survive the tree being replaced.\n //\n // `preserveScroll` is not enough on its own. It stops navigate() scrolling\n // to the top deliberately, and says nothing about the scroll positions\n // *inside* the page. Refreshing everything replaces the root, so every\n // element that scrolls is a new node and starts at zero — a sidebar,\n // a code block, any pane with its own overflow. The window survives because\n // the document element is not the thing being replaced, which is why this\n // looks fine until a page has a second scroller in it.\n const positions = scrollPositions();\n\n await navigate(url as Route, { replace: true, preserveScroll: true });\n\n restoreScroll(positions);\n}\n\ninterface ScrollPosition {\n tag: string;\n top: number;\n left: number;\n}\n\n/** Every element that can scroll, whether or not it currently is. */\nfunction scrollables(): HTMLElement[] {\n return [...document.querySelectorAll<HTMLElement>(\"*\")].filter(\n (el) =>\n el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth,\n );\n}\n\n/**\n * Where everything on the page is scrolled to, in document order.\n *\n * Identified by position in the list rather than by a selector: a refresh\n * re-renders the same page, so the nth scrollable element is the same one, and\n * a selector would have to survive whatever classes the markup happens to use.\n * The tag is carried only to notice when that assumption has broken.\n *\n * Everything that *can* scroll, not everything that *is* scrolled — the two\n * lists have to be built the same way or they do not line up. Recording only\n * the scrolled ones and restoring over the scrollable ones puts a sidebar's\n * position onto whatever element happens to come first, which on any page long\n * enough to scroll is <html>.\n */\nfunction scrollPositions(): ScrollPosition[] {\n return [\n { tag: \"window\", top: window.scrollY, left: window.scrollX },\n ...scrollables().map((el) => ({\n tag: el.tagName,\n top: el.scrollTop,\n left: el.scrollLeft,\n })),\n ];\n}\n\n/**\n * Put the page back where it was, once React has finished replacing it.\n *\n * Applied over several ticks rather than once, because `root.render()`\n * schedules the update instead of performing it: a single pass writes the\n * position onto the nodes that are about to be thrown away, and the ones that\n * replace them start at zero. There is nothing to await — the navigation\n * resolves when the tree is handed to React, not when React has committed it.\n *\n * `setTimeout`, not `requestAnimationFrame`. A hidden tab never runs an\n * animation frame, so a refresh in a background tab — an HMR update, a poll —\n * would leave the scroll state wrong the moment it came back into view. It\n * also makes this untestable in an automated browser, where the tab under test\n * is usually not the visible one.\n */\nconst RESTORE_ATTEMPTS = 5;\n\nfunction restoreScroll(positions: ScrollPosition[]): void {\n const [win, ...inner] = positions;\n\n const apply = (attempt: number) => {\n if (window.scrollY !== win.top || window.scrollX !== win.left) {\n window.scrollTo(win.left, win.top);\n }\n\n const now = scrollables();\n\n for (let i = 0; i < inner.length && i < now.length; i++) {\n // A different element here means the page came back a different shape,\n // and guessing further would scroll something nobody touched.\n if (now[i].tagName !== inner[i].tag) break;\n\n if (inner[i].top !== 0 && now[i].scrollTop !== inner[i].top)\n now[i].scrollTop = inner[i].top;\n if (inner[i].left !== 0 && now[i].scrollLeft !== inner[i].left)\n now[i].scrollLeft = inner[i].left;\n }\n\n if (attempt < RESTORE_ATTEMPTS) setTimeout(() => apply(attempt + 1), 16);\n };\n\n apply(1);\n}\n\nexport function prefetch(url: string, cacheForMs?: number): void {\n // Never a route.ts: fetching one runs it, and a hover is not a click.\n if (isApiRoute(url)) return;\n\n if (isExternalUrl(url)) return;\n\n const ttl = cacheForMs ?? DEFAULT_PREFETCH_TTL;\n const interceptSlot = matchIntercept(url);\n\n if (interceptSlot) {\n // Intercepted route — only prefetch the intercepted variant\n const currentUrl = window.location.pathname + window.location.search;\n const cacheKey = retentionKeyFor(url, interceptSlot);\n prefetchUrl(cacheKey, url, ttl, interceptSlot, currentUrl);\n } else {\n prefetchUrl(url, url, ttl);\n }\n}\n\nfunction prefetchUrl(\n cacheKey: string,\n url: string,\n ttl: number,\n interceptSlot?: string,\n refererUrl?: string,\n): void {\n const chain = claimedChain(interceptSlot ?? null);\n const existing = cache.get(cacheKey);\n\n if (existing && existing.expiresAt > Date.now()) {\n return;\n }\n\n cache.delete(cacheKey);\n makeRoom();\n\n const controller = new AbortController();\n prefetchControllers.set(cacheKey, controller);\n\n const entry: CacheEntry = {\n tree: Promise.resolve(null),\n expiresAt: Date.now() + ttl,\n segmentDepth: 0,\n layouts: null,\n slot: null,\n heldWhenFetched: chain.join(\",\"),\n redirectTo: null,\n failed: false,\n };\n\n // Low priority: the browser then lets a real navigation overtake a queue of\n // speculative requests instead of serving them in the order they were made.\n entry.tree = fetchRscPayload(\n url,\n controller.signal,\n interceptSlot,\n refererUrl,\n chain,\n \"low\",\n )\n .then((response) => {\n // On a static host there are no headers to read, and dropping the depth\n // is not a small loss: the entry then claims a segment is a whole\n // document, and rendering a layout-less page as the document root does\n // not warn — it hangs the renderer.\n // A prefetch that lands on a redirect is not cached. Following it would\n // navigate on hover, and storing it would hand the click a 204 with no\n // body to deserialize. The click re-requests and redirects properly.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n entry.redirectTo = redirectTo;\n cache.delete(cacheKey);\n\n return null;\n }\n\n entry.slot = response.headers.get(\"X-RSC-Revalidate\");\n\n const local = staticFetches.get(response) ?? null;\n\n entry.segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? local?.depth ?? 0,\n ) || 0;\n\n const served = response.headers.get(\"X-RSC-Layouts\");\n\n if (served !== null) {\n entry.layouts = served === \"\" ? [] : served.split(\",\");\n } else if (local) {\n entry.layouts = local.chain;\n }\n\n return deserializeResponse(response);\n })\n .catch(() => {\n entry.failed = true;\n cache.delete(cacheKey);\n return null;\n })\n .finally(() => {\n // Settled, so there is nothing left to abort. A completed prefetch stays\n // in the cache — only an in-flight one is ever dropped.\n if (prefetchControllers.get(cacheKey) === controller) {\n prefetchControllers.delete(cacheKey);\n }\n });\n\n cache.set(cacheKey, entry);\n}\n\n/**\n * Drop a prefetch that is still in flight — the pointer left the link.\n *\n * The cache entry goes synchronously rather than in the abort's catch: the\n * rejection lands a tick later, and a click in between would find an entry\n * whose tree resolves to null and navigate to a blank page. A prefetch that\n * has already completed is kept; there is no request left to cancel and the\n * payload is still good.\n */\nexport function cancelPrefetch(url: string): void {\n if (isExternalUrl(url)) return;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const controller = prefetchControllers.get(cacheKey);\n\n if (!controller) return;\n\n prefetchControllers.delete(cacheKey);\n cache.delete(cacheKey);\n controller.abort();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"navigate.js","sourceRoot":"","sources":["../../src/js/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAClD,6EAA6E;AAC7E,qDAAqD;AACrD,OAAO,EACL,UAAU,EACV,YAAY,IAAI,eAAe,EAC/B,WAAW,GACZ,MAAM,YAAY,CAAC;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vC,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,aAAa,CAAC,GAAG,CAAC;QAAE,OAAO;IAE/B,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAErD,IAAI,CAAC,UAAU;QAAE,OAAO;IAExB,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvB,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Core SPA navigation engine for RSC.\n *\n * Uses module-level state (singleton in the browser bundle).\n * The Flight deserializer is injected by createViteRscApp to avoid\n * duplicate bundling of react-server-dom-webpack.\n */\n\nimport { isStaleAssetError, loadDocumentOnce } from \"./staleAssets\";\nimport { isUpdated, markStale } from \"./updateStore\";\nimport { isSafeRedirect } from \"../safeUrl.js\";\nimport type { Route } from \"../routes.js\";\nimport { reportReachable } from \"./onlineStore\";\nimport { clearSlots, setSlot } from \"./slotStore\";\n// Shared with the host: it stores a page under this key and the client looks\n// under it, so the format cannot live in two places.\nimport {\n matchRoute,\n retentionKey as retentionKeyFor,\n sharedDepth,\n} from \"../routing\";\nimport type { ManifestRoute } from \"../manifest\";\n\ntype ReactNode = unknown;\ntype Deserializer = (\n stream: ReadableStream,\n options: Record<string, unknown>,\n) => Promise<ReactNode>;\ntype CallServerFn = (id: string, args: unknown[]) => Promise<unknown>;\n\ninterface CacheEntry {\n /**\n * The payload as it arrived, undecoded. Decoding a payload is what loads\n * the client chunks it names, and a prefetch decoded on arrival loaded\n * the sign-in page's thirty chunks onto a landing page for every phone\n * visitor, whether they tapped or not. The text is kept; \\`tree\\` decodes\n * it the first time a navigation asks, which is the moment those chunks\n * are wanted.\n */\n body: Promise<string | null>;\n /** The decoded page, on first read. */\n readonly tree: Promise<ReactNode>;\n expiresAt: number;\n /**\n * What the server said about the payload. A prefetch is a real request, so\n * it comes back partial like any other — losing that and treating it as a\n * whole document replaces the root with a page that has no layouts.\n */\n segmentDepth: number;\n layouts: string[] | null;\n /**\n * The slot this payload fills, when it is one region rather than a segment.\n *\n * A prefetch is a real request and comes back as whatever the host answers.\n * An interception answers with the interceptor alone, and an entry that\n * forgets that is applied as a whole document — so a hovered modal link\n * renders the modal *as* the page, with nothing around it. Only after a\n * hover, which is why a scripted click never finds it.\n */\n slot: string | null;\n /**\n * The chain held when this was prefetched. A partial payload is only valid\n * against the chain it was rendered for; navigate somewhere else first and\n * it no longer composes.\n */\n heldWhenFetched: string;\n /**\n * Where the prefetch was sent instead, when the host answered a redirect.\n * The entry leaves the cache - a hover must not navigate - but a click\n * that took the entry while the request was in flight awaits its tree, and\n * a tree of null committed as the page was the whole document gone: url\n * changed, root unmounted, nothing in the console. On a phone the tap's\n * touchstart prefetches with no delay and the click lands 100-300 ms\n * later, the length of a round trip, so a tapped link to a guarded page\n * blanked the page about half the time. The navigation reads this and\n * follows it, the way it follows a redirect on its own request.\n */\n redirectTo: string | null;\n /** The request failed or was aborted; a navigation that took the entry asks again. */\n failed: boolean;\n}\n\ninterface InterceptEntry {\n urlPattern: string;\n slot: string;\n}\n\nlet version = \"\";\n/** Pages a navigation is fetching right now, so a prefetch does not ask again. */\nconst navigating = new Set<string>();\nlet onNavigate:\n ((tree: ReactNode, key: string, segmentDepth: number) => void) | null = null;\nlet onRestore: ((key: string, maxAge?: number) => boolean) | null = null;\n\n/**\n * How stale a held page may be and still be revealed by a link.\n *\n * The back button ignores this: it names a moment, and the page from that\n * moment is the right answer however old. A link says \"go here\", so there is a\n * point past which answering with what you saw before is stale data presented\n * as fresh. Thirty seconds covers leaving a form to check something and coming\n * straight back, which is the case this exists for.\n */\nlet revealWithin = 30_000;\n\nexport function setRevealWindow(ms: number): void {\n revealWithin = ms;\n}\nlet flightDeserializer: Deserializer | null = null;\nlet callServerFn: CallServerFn | null = null;\nlet activeController: AbortController | null = null;\nconst cache = new Map<string, CacheEntry>();\n/** In-flight prefetches, so one the pointer moved away from can be dropped. */\nconst prefetchControllers = new Map<string, AbortController>();\nlet interceptManifest: InterceptEntry[] = [];\n\n// The layout chain currently mounted, outermost first. Sent so the server can\n// skip re-rendering the layouts still on screen.\nlet heldLayouts: string[] = [];\n\n/**\n * The boundary depth an interception was rendered at, while one is showing.\n *\n * An interceptor replaces a slot on the layout that declares it, so leaving the\n * intercepted view has to re-render that layout for the slot to go back to its\n * default. Left to itself the next navigation shares the whole chain, replaces\n * only the page below it, and the modal stays open over the new one.\n */\nlet interceptedAtDepth: number | null = null;\n\n/**\n * The url showing underneath an open interception.\n *\n * An interception puts something in a slot on a page that stays where it is,\n * so closing it is not a navigation at all — the page beneath was never\n * replaced. Remembering which url that is means going back to it costs\n * nothing, rather than fetching and rebuilding a page that is already on\n * screen with everything the user typed into it.\n */\nlet interceptedOver: string | null = null;\n\nconst DEFAULT_PREFETCH_TTL = 30_000;\n\n/**\n * How many prefetched payloads are kept. Entries carry a TTL but were only\n * dropped when read again, so a long session hovering its way through a big\n * nav held every payload it had ever fetched. On insert, anything expired\n * goes, and past the cap the oldest goes - insertion order is age.\n */\nconst MAX_CACHED = 50;\n\nfunction makeRoom(): void {\n const now = Date.now();\n\n for (const [key, entry] of cache) {\n if (entry.expiresAt <= now && !prefetchControllers.has(key))\n cache.delete(key);\n }\n\n while (cache.size >= MAX_CACHED) {\n const oldest = cache.keys().next().value as string | undefined;\n\n if (oldest === undefined) break;\n\n prefetchControllers.get(oldest)?.abort();\n prefetchControllers.delete(oldest);\n cache.delete(oldest);\n }\n}\n\n/**\n * Where a payload lives when there is no server to negotiate with.\n *\n * Normally the payload and the page share a url and are told apart by the\n * X-RSC header. A static host cannot vary by header — it serves one file per\n * url — so an exported build gives payloads their own addresses and the client\n * asks for those instead.\n */\nlet staticPayloadSuffix: string | null = null;\n\n/**\n * The route table, on a static host only.\n *\n * A server works out how much of the page to send by comparing the chain the\n * client sent with the route's own, and says so in a header. A file server\n * does neither — so on an exported site the client has to know the target's\n * layout chain before it asks, or every navigation takes the whole document\n * and replaces the root, which unmounts everything retained behind it.\n *\n * Inlined into the browser entry by the build, so it costs no request.\n */\nlet staticRoutes: ManifestRoute[] | null = null;\n\nexport function setStaticRoutes(routes: ManifestRoute[]): void {\n staticRoutes = routes;\n}\n\n/**\n * The layout chain of the page loaded from a file, since no header said.\n *\n * Without this the client believes it holds nothing, every navigation asks\n * for a whole document, and the depth variants sitting beside it are never\n * requested — the export looks correct and retention silently never happens.\n */\nexport function seedStaticChain(url: string): boolean {\n const segments = staticSegments(url);\n\n if (!segments) return false;\n\n heldLayouts = segments.chain;\n\n return true;\n}\n\n/**\n * The depth an exported payload should be asked for, and the chain it leaves\n * mounted — the two things a header would otherwise have carried.\n */\nfunction staticSegments(\n url: string,\n held: string[] = heldLayouts,\n): { depth: number; chain: string[] } | null {\n if (staticRoutes === null) return null;\n\n const path = new URL(url, window.location.origin).pathname;\n const match = matchRoute({ routes: staticRoutes } as never, path);\n\n if (!match) return null;\n\n return {\n // Against the chain the request is made with, never against whatever is\n // mounted by the time the answer arrives. A prefetch is fetched against\n // one chain and applied later, and reading live state here labels its\n // payload with a depth it was not rendered for.\n depth: sharedDepth(held.join(\",\"), match.route.layouts),\n // Copied: this is the build's table, and the caller assigns it to the\n // chain it holds — handing out the array itself makes the two the same\n // object.\n chain: [...match.route.layouts],\n };\n}\n\nexport function setStaticPayloads(suffix: string | null): void {\n staticPayloadSuffix = suffix;\n}\n\n/** The url to request a payload from, which is the page's own unless exported. */\nexport function payloadUrl(url: string, held: string[] = heldLayouts): string {\n if (staticPayloadSuffix === null) return url;\n\n const parsed = new URL(url, window.location.origin);\n const path = parsed.pathname.replace(/\\/+$/, \"\");\n const segments = staticSegments(url, held);\n\n // The variant for exactly the depth this client shares. Asking for the whole\n // document when a segment would do is not merely wasteful: it replaces the\n // root, and replacing the root throws away every page retained behind it.\n const name =\n segments && segments.depth > 0\n ? staticPayloadSuffix.replace(/^index\\./, `index.seg${segments.depth}.`)\n : staticPayloadSuffix;\n\n return `${path}/${name}${parsed.search}`;\n}\n\n/**\n * What a static payload was fetched as, recorded against its own response.\n *\n * The depth asked for and the depth applied have to be the same number. Worked\n * out separately at the two call sites they can disagree — and a payload\n * rendered whole but applied as a segment nests a boundary inside itself,\n * which does not error, it recurses until the renderer stops responding.\n */\nconst staticFetches = new WeakMap<\n Response,\n { depth: number; chain: string[] }\n>();\n\nexport function setVersion(v: string): void {\n version = v;\n}\n\n/**\n * Tell the worker which build the server is on, and wait to be heard - a\n * document load follows, and the message has to land before the request\n * the load makes. Bounded: a worker that does not answer is not worth a\n * visitor's wait, and a page with no worker has nothing to tell.\n */\nasync function tellWorkerServerBuild(build: string | null): Promise<void> {\n if (!build || typeof navigator === \"undefined\" || !(\"serviceWorker\" in navigator)) return;\n\n const worker = navigator.serviceWorker.controller;\n\n if (!worker) return;\n\n await new Promise<void>((resolve) => {\n const channel = new MessageChannel();\n const done = () => {\n clearTimeout(timer);\n resolve();\n };\n const timer = setTimeout(done, 300);\n\n channel.port1.onmessage = done;\n worker.postMessage({ type: \"rsc-kit:server-build\", version: build }, [channel.port2]);\n });\n\n // And look for the successor now rather than on the next navigation.\n void navigator.serviceWorker.getRegistration().then((registration) => registration?.update()).catch(() => {});\n}\n\n/**\n * The layout chain the client is holding.\n *\n * Seeded from the initial page's response and updated on every navigation, so\n * the next request can say what is already mounted.\n */\nexport function setHeldLayouts(chain: string[]): void {\n heldLayouts = chain;\n}\n\nexport function getHeldLayouts(): string[] {\n return heldLayouts;\n}\n\nexport function setNavigateHandler(\n fn: (tree: ReactNode, key: string, segmentDepth: number) => void,\n): void {\n onNavigate = fn;\n}\n\n/**\n * How the router reveals a page that is still mounted behind the current one.\n *\n * Returning true means the page was restored with its client state intact and\n * no request was made.\n */\nexport function setRestoreHandler(\n fn: (key: string, maxAge?: number) => boolean,\n): void {\n onRestore = fn;\n}\n\nexport function setDeserializer(fn: Deserializer): void {\n flightDeserializer = fn;\n}\n\nexport function setCallServer(fn: CallServerFn): void {\n callServerFn = fn;\n}\n\n/**\n * The urls a route.ts answers, so a link to one is treated as the anchor it\n * is: no prefetch - a hover must not run a route - and a full navigation\n * rather than a payload fetch, since the answer is a Response, not a page.\n * Baked into the generated browser entry from the route tree.\n */\nlet apiRoutePatterns: RegExp[] = [];\n\nexport function setApiRoutes(patterns: string[]): void {\n apiRoutePatterns = patterns.map(\n (pattern) =>\n new RegExp(\n \"^\" +\n pattern\n .split(\"/\")\n .map((part) =>\n part.startsWith(\"[...\") ? \".+\" : part.startsWith(\"[\") ? \"[^/]+\" : part.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"),\n )\n .join(\"/\") +\n \"/?$\",\n ),\n );\n}\n\n/** Whether a url is one a route.ts answers. */\nexport function isApiRoute(url: string): boolean {\n if (apiRoutePatterns.length === 0) return false;\n\n try {\n const { pathname } = new URL(url, window.location.origin);\n\n return apiRoutePatterns.some((pattern) => pattern.test(pathname));\n } catch {\n return false;\n }\n}\n\nexport function setInterceptManifest(entries: InterceptEntry[]): void {\n interceptManifest = entries;\n}\n\n/**\n * Check if a URL matches any intercept pattern.\n * Returns the matching slot name, or null if no match.\n */\nfunction matchIntercept(url: string): string | null {\n if (interceptManifest.length === 0) return null;\n\n let pathname: string;\n try {\n pathname = new URL(url, window.location.origin).pathname;\n } catch {\n pathname = url.split(\"?\")[0];\n }\n\n for (const entry of interceptManifest) {\n // urlPattern already has a leading slash (e.g. \"/docs/item/[id]\")\n const regex = new RegExp(\n \"^\" +\n entry.urlPattern\n .replace(/\\[\\.\\.\\.(\\w+)\\]/g, \"(.+)\")\n .replace(/\\[(\\w+)\\]/g, \"([^/]+)\") +\n \"$\",\n );\n\n if (regex.test(pathname)) {\n return entry.slot;\n }\n }\n\n return null;\n}\n\nexport function renderTree(tree: ReactNode): void {\n onNavigate?.(tree, retentionKey(window.location.href, null), 0);\n}\n\n/**\n * Identity of a page for retention purposes.\n *\n * Path and query only: a hash is a position within the same page, and an\n * intercepted route is a different rendering of the same URL, so it retains\n * separately from the full page.\n */\nexport function retentionKey(\n url: string,\n interceptSlot: string | null,\n): string {\n let path: string;\n\n try {\n const parsed = new URL(url, window.location.origin);\n path = parsed.pathname + parsed.search;\n } catch {\n path = url.split(\"#\")[0];\n }\n\n return retentionKeyFor(path, interceptSlot);\n}\n\nexport function getCallServer(): CallServerFn {\n if (!callServerFn) {\n throw new Error(\n \"callServer not initialized. Ensure createViteRscApp() has been called.\",\n );\n }\n return callServerFn;\n}\n\nfunction fetchRscPayload(\n url: string,\n signal?: AbortSignal,\n interceptSlot?: string,\n refererUrl?: string,\n chain: string[] = heldLayouts,\n // A prefetch is speculative and a navigation is not, but on the wire they\n // were identical — so a click could queue behind several prefetches the user\n // had already moved past. Over HTTP/1.1 a browser opens ~6 connections per\n // origin, which a sweep across a nav bar fills on its own.\n priority: \"high\" | \"low\" = \"high\",\n /**\n * A prefetch is speculative: a 409 on one must not load a document the\n * visitor never asked for. A viewport prefetch of the sign-in link, sent\n * from an old page after a deploy, took the visitor reading the home page\n * to /login half a second after it appeared - and a hover over a sidebar\n * link did the same to a half-filled form. The session is marked stale\n * instead, so the next navigation the visitor makes is a document load.\n */\n speculative = false,\n): Promise<Response> {\n const headers: Record<string, string> = {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n };\n\n if (chain.length) {\n headers[\"X-RSC-Segments\"] = chain.join(\",\");\n }\n\n if (interceptSlot) {\n headers[\"X-RSC-Intercept\"] = interceptSlot;\n }\n\n if (refererUrl) {\n headers[\"X-RSC-Referer\"] = refererUrl;\n }\n\n // `priority` is not in every lib.dom yet; browsers without it ignore it.\n const asked = staticSegments(url, chain);\n const request = fetch(payloadUrl(url, chain), {\n headers,\n signal,\n priority,\n } as RequestInit).catch((err: unknown) => {\n // Nothing answered at all. An abort is our own doing, not the network's —\n // leaving a link cancels its prefetch, and that must not read as offline.\n if (!(err instanceof DOMException && err.name === \"AbortError\")) {\n reportReachable(false);\n }\n\n throw err;\n });\n\n return request.then(async (response) => {\n // What this payload was asked for, so the apply side cannot work out a\n // different answer from state that has moved on since.\n if (asked) staticFetches.set(response, asked);\n\n // Something answered, whatever it said. A 500 is a reachable server.\n reportReachable(true);\n // Adopt the server's build version from the first response that carries\n // one. Until we know it we send an empty version, which the middleware\n // treats as \"no opinion\"; afterwards a redeploy mid-session answers 409.\n const served = response.headers.get(\"X-RSC-Version\");\n\n if (served && version === \"\") {\n version = served;\n }\n\n if (response.status === 409) {\n const location = response.headers.get(\"X-RSC-Location\");\n // Server-chosen, so checked again here: the engine refuses these at the\n // source, but a host in front of it can put anything on the header.\n // Once per url: a worker still serving the last build's document would\n // answer the load with it, and the next click would be here again.\n const to = isSafeRedirect(location ?? url) ? (location ?? url) : url;\n\n // The worker first. It serves a stored document from its cache, and\n // its cache is the build this page came from - the document it would\n // answer the load with is the one being left. Told which build the\n // server is on, it serves the network for a copy from any other, and\n // is asked to look for its successor. Then the load.\n await tellWorkerServerBuild(served);\n\n if (speculative) {\n markStale();\n\n throw new Error(\"This page is from an earlier build; the next navigation loads the document\");\n }\n\n throw new Error(\n loadDocumentOnce(to)\n ? \"This page is from an earlier build; loading the document from the current one\"\n : \"This page is from an earlier build, and loading the document did not bring the current one\",\n );\n }\n\n return response;\n });\n}\n\n/**\n * Deserialize a Flight response into a React tree.\n *\n * Client modules, CSS <link>s and <title>/<meta> all travel inside the Flight\n * payload — @vitejs/plugin-rsc emits stylesheet links as tree elements and\n * resolves client references through its own browser runtime, and React 19\n * hoists document metadata into <head>. Nothing needs injecting from headers.\n */\nfunction deserializeResponse(response: Response): Promise<ReactNode> {\n return flightDeserializer!(response.body!, {\n callServer:\n callServerFn ??\n (async () => {\n throw new Error(\"Server actions not initialized\");\n }),\n });\n}\n\nfunction isExternalUrl(url: string): boolean {\n try {\n return (\n new URL(url, window.location.origin).origin !== window.location.origin\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a cached payload can be used for a navigation claiming this chain.\n *\n * A partial payload only composes against the chain it was rendered for, so\n * the chain it was fetched against has to be the one the navigation is about\n * to claim — not whatever happens to be mounted.\n */\nfunction isUsable(cached: CacheEntry | undefined, chain: string[]): boolean {\n return (\n cached !== undefined &&\n cached.expiresAt > Date.now() &&\n cached.heldWhenFetched === chain.join(\",\")\n );\n}\n\n/**\n * Whether a navigation to this url would be served from the prefetch cache.\n *\n * Lets a caller decide whether showing an already-fetched page is free. A form\n * uses it to put its target route's shell on screen while the real query runs:\n * worth doing when the shell is in hand, never worth an extra request.\n */\nexport function isPrefetched(url: string): boolean {\n if (isExternalUrl(url)) return false;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n return isUsable(cache.get(cacheKey), claimedChain(interceptSlot));\n}\n\n/**\n * The layout chain a navigation to a url will claim.\n *\n * Leaving an interception claims fewer layouts than are held, which is what\n * forces the layout owning the slot to render again so the slot can empty.\n * Both sides have to agree on it: a prefetch recorded against a different\n * chain can never be used, so the close of every modal refetched a payload it\n * had already fetched.\n */\nfunction claimedChain(interceptSlot: string | null): string[] {\n return !interceptSlot && interceptedAtDepth !== null\n ? heldLayouts.slice(0, interceptedAtDepth)\n : heldLayouts;\n}\n\n/**\n * How many redirects a single navigation will follow before giving up.\n *\n * A page that redirects to itself is a mistake someone will make, and without\n * a ceiling it is an unbounded loop of requests rather than an error. The\n * browser's own limit for HTTP redirects is 20; this is smaller because these\n * are full renders, not header exchanges.\n */\nconst MAX_REDIRECTS = 8;\n\n/**\n * Go to a url, the way a Link does.\n *\n * `url` is typed to the routes the build found; cast with `as Route` when the\n * destination is computed rather than written.\n */\nexport async function navigate(\n url: Route,\n opts?: {\n replace?: boolean;\n preserveScroll?: boolean;\n restore?: boolean;\n /** Internal: how many redirects led here. */\n redirectsFollowed?: number;\n },\n): Promise<void> {\n const redirectsFollowed = opts?.redirectsFollowed ?? 0;\n\n // The worker has said a newer build is live. This page's client cannot\n // load what that build's payloads name, so the next navigation is the\n // document, from the new build - the router knows; the banner was only\n // advice. Not for a restore: going back to a page still held asks the\n // server for nothing.\n if (!opts?.restore && isUpdated()) {\n window.location.href = url;\n\n return;\n }\n\n if (redirectsFollowed > MAX_REDIRECTS) {\n throw new Error(\n `Too many redirects following a navigation (${MAX_REDIRECTS}); last was ${url}`,\n );\n }\n\n // External URLs can't be fetched (CORS) — go directly to full page navigation\n if (isExternalUrl(url)) {\n window.location.href = url;\n return;\n }\n\n // A route.ts answers with a Response, not a page: a download, a redirect\n // that decides where someone belongs, a sign-out. The browser goes there.\n if (isApiRoute(url)) {\n window.location.href = url;\n return;\n }\n\n // Hash-only URLs — let the browser handle scrolling natively\n if (url.startsWith(\"#\")) {\n window.location.hash = url;\n return;\n }\n\n // Abort any in-flight navigation\n activeController?.abort();\n\n // Not window.stop(). It used to be called here while the document was\n // still loading, to free a single-threaded server for the new request -\n // and it cancels every load the page has in flight: the client chunks a\n // just-decoded tree still needs, the stylesheet, the boundaries still\n // streaming. A navigation that left the page before the runtime had\n // finished arriving rendered a document with nothing in it. The server\n // has workers; the page keeps loading.\n\n const controller = new AbortController();\n activeController = controller;\n\n // Check if this URL matches an intercept pattern.\n // If so, send the intercept slot + current URL as referer so the server\n // renders the full tree with the interceptor in the right slot.\n const interceptSlot = matchIntercept(url);\n const currentUrl = interceptSlot\n ? window.location.pathname + window.location.search\n : undefined;\n\n const activityKey = retentionKey(url, interceptSlot);\n\n // A page still being held is revealed rather than refetched, whichever\n // gesture asked for it — the back button or a link. Both mean \"the page I\n // was just on\", and having the form you were filling in survive one and not\n // the other is a distinction nobody makes while using the app.\n //\n // The cost is honest: what comes back is the tree from when you left, so its\n // data is from then. Retention is four pages deep, so this reaches only\n // somewhere you were moments ago, and `revalidate()` is how a page says its\n // data has moved on.\n // Closing an interception. The page underneath was never replaced, so this\n // is a matter of emptying the slot — no request, and nothing rebuilt. The\n // form behind the modal is still the one the user was filling in.\n if (\n !interceptSlot &&\n interceptedOver !== null &&\n retentionKey(url, null) === retentionKey(interceptedOver, null)\n ) {\n clearSlots();\n interceptedOver = null;\n interceptedAtDepth = null;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // Not when the target is the page already showing: asking for this page\n // again means asking the server again, and revealing what is already there\n // would make refresh a no-op. Not while an interception is opening or\n // closing either — those rebuild the chain deliberately.\n const askingForThisPage =\n retentionKey(window.location.href, null) === retentionKey(url, null);\n //\n // And not while an interception is on screen. Leaving a modal has to\n // re-render the layout that owns the slot, because that is what empties it;\n // revealing the page underneath instead leaves the modal sitting over a page\n // whose url has already changed.\n const mayReveal =\n opts?.restore === true ||\n (!askingForThisPage &&\n !interceptSlot &&\n interceptedOver === null &&\n interceptedAtDepth === null);\n\n // Unbounded for the back button, bounded for a link.\n if (\n mayReveal &&\n onRestore?.(activityKey, opts?.restore ? undefined : revealWithin)\n ) {\n // A restored tree carries its own slot contents, so the flag only has to\n // reflect whether what is now showing is an intercepted view.\n if (!interceptSlot) interceptedAtDepth = null;\n\n // opts?.replace, not opts.replace: this branch used to be reachable only\n // with opts.restore set, so opts was always there. A link reaches it now\n // with nothing passed at all.\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // A prefetched payload was rendered against the chain held at prefetch time.\n let segmentDepth = 0;\n let nextLayouts: string[] | null = null;\n /** The slot this answer fills, when it is one region rather than a segment. */\n let slotPayload: string | null = null;\n /** The cache entry this navigation is using, whose metadata settles with it. */\n let reused: CacheEntry | null = null;\n const previousUrl = window.location.pathname + window.location.search;\n\n try {\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const cached = cache.get(cacheKey);\n let treePromise: Promise<ReactNode>;\n\n const chain = claimedChain(interceptSlot);\n\n // A partial payload only composes against the chain it was rendered for —\n // the one this navigation is about to claim, not whatever is mounted.\n // Hovering a link inside a modal prefetches it against the full chain, so\n // reusing that here would skip the layout holding the modal and leave it\n // open over the page behind it.\n const usable = isUsable(cached, chain);\n\n if (usable) {\n treePromise = cached!.tree;\n // Read after the tree resolves, not now. A prefetch fills these in when\n // its response lands, and a click can land first — hover a modal link\n // and click it quickly and the entry still says depth 0, so the\n // interceptor is applied as a whole document and the modal renders *as*\n // the page. The fields are set before the tree promise resolves, so\n // waiting for it is what makes them true.\n reused = cached!;\n cache.delete(cacheKey);\n } else {\n cache.delete(cacheKey);\n\n // Marked while in flight, so a prefetch of the same page - a held\n // tap's replay landing beside the idle viewport prefetch of the link\n // it came from - does not ask for it a second time.\n navigating.add(cacheKey);\n\n let response: Response;\n\n try {\n response = await fetchRscPayload(\n url,\n controller.signal,\n interceptSlot ?? undefined,\n currentUrl,\n chain,\n );\n } finally {\n navigating.delete(cacheKey);\n }\n\n // The check is for a host that answered the page instead of the\n // payload, which is what a server does when it does not recognise the\n // header. An exported build asks a url that only ever holds a payload,\n // and a file server labels it by extension — commonly\n // application/octet-stream — so the check would reject every navigation\n // and send the browser on a full page load instead.\n // The render asked to go somewhere else, and said so before writing\n // anything — so this is still a navigation, not a page load. A redirect\n // decided later than that cannot travel here; it arrives in the payload\n // as an error digest and RedirectBoundary performs it.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n // The url that redirected was never pushed - the history entry is\n // written after the tree arrives, below - so the destination takes\n // this navigation's own mode. `replace: true` here replaced the page\n // the visitor was ON, and Back from the login page skipped home.\n // Chosen by the server, not written here.\n await navigate(redirectTo as Route, {\n replace: opts?.replace,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n const contentType = response.headers.get(\"Content-Type\") ?? \"\";\n\n if (\n staticPayloadSuffix === null &&\n !contentType.includes(\"text/x-component\")\n ) {\n window.location.href = url;\n return;\n }\n\n // Headers on a server; worked out locally on a static host, where there\n // is nothing to send them.\n const served = staticFetches.get(response) ?? null;\n\n segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? served?.depth ?? 0,\n ) || 0;\n\n // Named region rather than a segment — see the apply below.\n slotPayload = response.headers.get(\"X-RSC-Revalidate\");\n\n const servedLayouts = response.headers.get(\"X-RSC-Layouts\");\n\n if (servedLayouts !== null) {\n nextLayouts = servedLayouts === \"\" ? [] : servedLayouts.split(\",\");\n } else if (served) {\n nextLayouts = served.chain;\n }\n\n treePromise = deserializeResponse(response);\n }\n\n let tree: ReactNode;\n\n try {\n tree = await treePromise;\n } catch (error) {\n // A navigation another one overtook: its request was aborted, and\n // the decoder reports that as a failure of the payload. It is not one\n // - nothing of it was going to be shown - so it ends here, quietly,\n // rather than as a rejection nobody is waiting on.\n if (controller.signal.aborted) return;\n\n throw error;\n }\n\n if (reused) {\n if (controller.signal.aborted) return;\n\n // The prefetch this navigation took did not come back as a page. A\n // redirect is followed as one on this request would be; a failure is\n // asked again, from a cache that no longer holds the entry.\n if (reused.redirectTo) {\n await navigate(reused.redirectTo as Route, {\n replace: opts?.replace,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n if (reused.failed) {\n await navigate(url, opts);\n\n return;\n }\n\n segmentDepth = reused.segmentDepth;\n nextLayouts = reused.layouts;\n slotPayload = reused.slot;\n }\n\n if (controller.signal.aborted) return;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n if (nextLayouts !== null) heldLayouts = nextLayouts;\n\n // The answer is one region, not a piece of the page: the host rendered\n // only the interceptor because the page underneath is already mounted and\n // still correct. Putting it in the slot leaves that page — and everything\n // typed into it — exactly as it was.\n if (slotPayload !== null) {\n setSlot(slotPayload, tree as ReactNode);\n interceptedOver = interceptedOver ?? previousUrl;\n interceptedAtDepth = null;\n\n return;\n }\n\n // A slot rendered for the page being left has no claim on the one being\n // arrived at.\n clearSlots();\n\n interceptedOver = null;\n interceptedAtDepth = interceptSlot ? segmentDepth : null;\n\n onNavigate?.(tree, activityKey, segmentDepth);\n\n if (!opts?.preserveScroll && !interceptSlot) {\n // Wait for React to commit the DOM update before scrolling.\n // Intercepted navigations preserve scroll (e.g. modal over current page).\n requestAnimationFrame(() => {\n window.scrollTo(0, 0);\n });\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n } catch (err) {\n if (err instanceof DOMException && err.name === \"AbortError\") return;\n\n // A chunk the deploy no longer serves: the browser would have loaded the\n // document, and the new names with it. Do what it would have done.\n if (isStaleAssetError(err)) {\n window.location.href = url;\n\n return;\n }\n\n // Without this a navigation that fails does nothing observable: the click\n // clears its own pending state and the page stays as it was, with no\n // error, no fallback and nothing for an app to react to. Dispatched before\n // rethrowing, so a programmatic caller still sees the failure.\n window.dispatchEvent(\n new CustomEvent(\"rsc-navigate-error\", { detail: { url, error: err } }),\n );\n\n throw err;\n } finally {\n if (activeController === controller) {\n activeController = null;\n }\n }\n}\n\n/**\n * Put something the server re-rendered on screen.\n *\n * The trees arrive with an action's answer rather than being fetched, so this\n * is the same apply path a navigation uses — without a request, a url change\n * or a history entry.\n */\nexport function applyRevalidated(target: string, tree: ReactNode): void {\n const url = window.location.pathname + window.location.search;\n const key = retentionKey(url, null);\n\n if (target === \"all\") {\n // Depth 0 replaces the root, which is what re-rendering the layouts means.\n onNavigate?.(tree, key, 0);\n\n return;\n }\n\n if (target === \"page\") {\n onNavigate?.(tree, key, heldLayouts.length);\n\n return;\n }\n\n setSlot(target, tree);\n}\n\n/**\n * Ask the server for part of this page again.\n *\n * refresh() the page, leaving the layouts mounted\n * refresh('all') the whole document, layouts included\n * refresh('orders') one parallel slot, by the name its directory gave it\n *\n * The same words an action uses, so a thing can be invalidated from either\n * side. This is the path for a refresh nobody mutated anything to earn — a\n * button, a poll, a message saying that table has moved; what an action\n * invalidated travels back inside the action's own answer instead.\n *\n * A slot is the only region smaller than a page the server can name, so two\n * tables refresh apart from each other only if they are two slots. The page\n * form leaves the layouts alone, which is what makes it cheap and also why a\n * count living in a layout will not move until you ask for 'all'.\n */\nexport async function refresh(target = \"page\"): Promise<void> {\n const url = window.location.pathname + window.location.search;\n\n if (target !== \"page\" && target !== \"all\") {\n const response = await fetch(payloadUrl(url), {\n headers: {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n \"X-RSC-Revalidate\": target,\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Could not revalidate ${target}: the server answered ${response.status}`,\n );\n }\n\n setSlot(target, await deserializeResponse(response));\n\n return;\n }\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n // Never from the cache: refreshing asks what the server says now, not what\n // it said a moment ago.\n cache.delete(cacheKey);\n\n if (target === \"all\") {\n heldLayouts = [];\n }\n\n // A refresh is not a navigation: the same page stays under the reader, so\n // where they were reading has to survive the tree being replaced.\n //\n // `preserveScroll` is not enough on its own. It stops navigate() scrolling\n // to the top deliberately, and says nothing about the scroll positions\n // *inside* the page. Refreshing everything replaces the root, so every\n // element that scrolls is a new node and starts at zero — a sidebar,\n // a code block, any pane with its own overflow. The window survives because\n // the document element is not the thing being replaced, which is why this\n // looks fine until a page has a second scroller in it.\n const positions = scrollPositions();\n\n await navigate(url as Route, { replace: true, preserveScroll: true });\n\n restoreScroll(positions);\n}\n\ninterface ScrollPosition {\n tag: string;\n top: number;\n left: number;\n}\n\n/** Every element that can scroll, whether or not it currently is. */\nfunction scrollables(): HTMLElement[] {\n return [...document.querySelectorAll<HTMLElement>(\"*\")].filter(\n (el) =>\n el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth,\n );\n}\n\n/**\n * Where everything on the page is scrolled to, in document order.\n *\n * Identified by position in the list rather than by a selector: a refresh\n * re-renders the same page, so the nth scrollable element is the same one, and\n * a selector would have to survive whatever classes the markup happens to use.\n * The tag is carried only to notice when that assumption has broken.\n *\n * Everything that *can* scroll, not everything that *is* scrolled — the two\n * lists have to be built the same way or they do not line up. Recording only\n * the scrolled ones and restoring over the scrollable ones puts a sidebar's\n * position onto whatever element happens to come first, which on any page long\n * enough to scroll is <html>.\n */\nfunction scrollPositions(): ScrollPosition[] {\n return [\n { tag: \"window\", top: window.scrollY, left: window.scrollX },\n ...scrollables().map((el) => ({\n tag: el.tagName,\n top: el.scrollTop,\n left: el.scrollLeft,\n })),\n ];\n}\n\n/**\n * Put the page back where it was, once React has finished replacing it.\n *\n * Applied over several ticks rather than once, because `root.render()`\n * schedules the update instead of performing it: a single pass writes the\n * position onto the nodes that are about to be thrown away, and the ones that\n * replace them start at zero. There is nothing to await — the navigation\n * resolves when the tree is handed to React, not when React has committed it.\n *\n * `setTimeout`, not `requestAnimationFrame`. A hidden tab never runs an\n * animation frame, so a refresh in a background tab — an HMR update, a poll —\n * would leave the scroll state wrong the moment it came back into view. It\n * also makes this untestable in an automated browser, where the tab under test\n * is usually not the visible one.\n */\nconst RESTORE_ATTEMPTS = 5;\n\nfunction restoreScroll(positions: ScrollPosition[]): void {\n const [win, ...inner] = positions;\n\n const apply = (attempt: number) => {\n if (window.scrollY !== win.top || window.scrollX !== win.left) {\n window.scrollTo(win.left, win.top);\n }\n\n const now = scrollables();\n\n for (let i = 0; i < inner.length && i < now.length; i++) {\n // A different element here means the page came back a different shape,\n // and guessing further would scroll something nobody touched.\n if (now[i].tagName !== inner[i].tag) break;\n\n if (inner[i].top !== 0 && now[i].scrollTop !== inner[i].top)\n now[i].scrollTop = inner[i].top;\n if (inner[i].left !== 0 && now[i].scrollLeft !== inner[i].left)\n now[i].scrollLeft = inner[i].left;\n }\n\n if (attempt < RESTORE_ATTEMPTS) setTimeout(() => apply(attempt + 1), 16);\n };\n\n apply(1);\n}\n\nexport function prefetch(url: string, cacheForMs?: number): void {\n // Never a route.ts: fetching one runs it, and a hover is not a click.\n if (isApiRoute(url)) return;\n\n // Never the page the visitor is on. A logo link to / on the home page,\n // in view, was a 14 KB payload for the page already on screen.\n if (retentionKey(url, null) === retentionKey(window.location.href, null)) return;\n\n // Nor anything, once this page is known to be the previous build: the\n // next navigation is a document load, and a payload it would not use is\n // a 409 for nothing - one per tap, measured.\n if (isUpdated()) return;\n\n if (isExternalUrl(url)) return;\n\n const ttl = cacheForMs ?? DEFAULT_PREFETCH_TTL;\n const interceptSlot = matchIntercept(url);\n\n if (interceptSlot) {\n // Intercepted route — only prefetch the intercepted variant\n const currentUrl = window.location.pathname + window.location.search;\n const cacheKey = retentionKeyFor(url, interceptSlot);\n prefetchUrl(cacheKey, url, ttl, interceptSlot, currentUrl);\n } else {\n prefetchUrl(url, url, ttl);\n }\n}\n\nfunction prefetchUrl(\n cacheKey: string,\n url: string,\n ttl: number,\n interceptSlot?: string,\n refererUrl?: string,\n): void {\n const chain = claimedChain(interceptSlot ?? null);\n const existing = cache.get(cacheKey);\n\n if (existing && existing.expiresAt > Date.now()) {\n return;\n }\n\n // A navigation is already fetching it; the answer is on its way.\n if (navigating.has(cacheKey)) return;\n\n cache.delete(cacheKey);\n makeRoom();\n\n const controller = new AbortController();\n prefetchControllers.set(cacheKey, controller);\n\n let decoded: Promise<ReactNode> | null = null;\n const entry: CacheEntry = {\n body: Promise.resolve(null),\n get tree() {\n return (decoded ??= this.body.then((text) => (text === null ? null : deserializeResponse(new Response(text)))));\n },\n expiresAt: Date.now() + ttl,\n segmentDepth: 0,\n layouts: null,\n slot: null,\n heldWhenFetched: chain.join(\",\"),\n redirectTo: null,\n failed: false,\n };\n\n // Low priority: the browser then lets a real navigation overtake a queue of\n // speculative requests instead of serving them in the order they were made.\n entry.body = fetchRscPayload(\n url,\n controller.signal,\n interceptSlot,\n refererUrl,\n chain,\n \"low\",\n true,\n )\n .then((response) => {\n // On a static host there are no headers to read, and dropping the depth\n // is not a small loss: the entry then claims a segment is a whole\n // document, and rendering a layout-less page as the document root does\n // not warn — it hangs the renderer.\n // A prefetch that lands on a redirect is not cached. Following it would\n // navigate on hover, and storing it would hand the click a 204 with no\n // body to deserialize. The click re-requests and redirects properly.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n // The guard's answer is kept, for the entry's TTL, and the\n // destination is prefetched now. A tap on the link then goes\n // straight to a payload already here: no request for the page the\n // visitor may not see, none for the one they will. Before this,\n // every tap on a guarded link paid the guard's round trip and the\n // destination's, in sequence - on a phone, the two slowest things a\n // navigation can do, and the port's \"Sign in is slow from home\".\n // Next's prefetch follows the redirect the same way.\n entry.redirectTo = redirectTo;\n\n if (!isExternalUrl(redirectTo) && isSafeRedirect(redirectTo)) prefetch(redirectTo, ttl);\n\n return null;\n }\n\n entry.slot = response.headers.get(\"X-RSC-Revalidate\");\n\n const local = staticFetches.get(response) ?? null;\n\n entry.segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? local?.depth ?? 0,\n ) || 0;\n\n const served = response.headers.get(\"X-RSC-Layouts\");\n\n if (served !== null) {\n entry.layouts = served === \"\" ? [] : served.split(\",\");\n } else if (local) {\n entry.layouts = local.chain;\n }\n\n // The bytes, not the page: decoding is the navigation's, see CacheEntry.\n return response.text();\n })\n .catch(() => {\n entry.failed = true;\n cache.delete(cacheKey);\n return null;\n })\n .finally(() => {\n // Settled, so there is nothing left to abort. A completed prefetch stays\n // in the cache — only an in-flight one is ever dropped.\n if (prefetchControllers.get(cacheKey) === controller) {\n prefetchControllers.delete(cacheKey);\n }\n });\n\n cache.set(cacheKey, entry);\n}\n\n/**\n * Drop a prefetch that is still in flight — the pointer left the link.\n *\n * The cache entry goes synchronously rather than in the abort's catch: the\n * rejection lands a tick later, and a click in between would find an entry\n * whose tree resolves to null and navigate to a blank page. A prefetch that\n * has already completed is kept; there is no request left to cancel and the\n * payload is still good.\n */\nexport function cancelPrefetch(url: string): void {\n if (isExternalUrl(url)) return;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const controller = prefetchControllers.get(cacheKey);\n\n if (!controller) return;\n\n prefetchControllers.delete(cacheKey);\n cache.delete(cacheKey);\n controller.abort();\n}\n"]}
|
package/dist/js/updateStore.d.ts
CHANGED
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
* works until it navigates somewhere that needs one.
|
|
13
13
|
*/
|
|
14
14
|
export declare function isUpdated(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The server said so itself - a 409 to this page's build on a request the
|
|
17
|
+
* visitor did not make. No confirmation needed: the answer is the
|
|
18
|
+
* confirmation. The next navigation is a document load.
|
|
19
|
+
*/
|
|
20
|
+
export declare function markStale(): void;
|
|
15
21
|
export declare function subscribeToUpdates(callback: () => void): () => void;
|
|
16
22
|
/** The server render's answer. A fresh document is by definition not stale. */
|
|
17
23
|
export declare function updatedOnServer(): boolean;
|
package/dist/js/updateStore.js
CHANGED
|
@@ -20,10 +20,48 @@ function announce() {
|
|
|
20
20
|
updated = true;
|
|
21
21
|
listeners.forEach((fn) => fn());
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The worker's news is about the worker: a newer one took over. Whether
|
|
25
|
+
* this PAGE is stale is a different question, and the server answers it -
|
|
26
|
+
* a page loaded from the network while the new worker was still installing
|
|
27
|
+
* is already the new build, and told to reload it reloaded into itself.
|
|
28
|
+
* One request, with the build the document says it is: 409 is stale, 200
|
|
29
|
+
* is current, and no answer at all is treated as stale, the safe reading.
|
|
30
|
+
*/
|
|
31
|
+
let confirming = null;
|
|
32
|
+
async function confirm() {
|
|
33
|
+
// One deploy is two signals - the worker's message and controllerchange
|
|
34
|
+
// - and was two requests. One in flight at a time answers both.
|
|
35
|
+
if (updated)
|
|
36
|
+
return;
|
|
37
|
+
if (confirming)
|
|
38
|
+
return confirming;
|
|
39
|
+
confirming = ask().finally(() => {
|
|
40
|
+
confirming = null;
|
|
41
|
+
});
|
|
42
|
+
return confirming;
|
|
43
|
+
}
|
|
44
|
+
async function ask() {
|
|
45
|
+
const build = document.querySelector('meta[name="rsc-kit:build"]')?.getAttribute('content');
|
|
46
|
+
if (!build)
|
|
47
|
+
return announce();
|
|
48
|
+
try {
|
|
49
|
+
const response = await fetch(window.location.href, {
|
|
50
|
+
method: 'HEAD',
|
|
51
|
+
headers: { 'X-RSC': '1', 'X-RSC-Version': build },
|
|
52
|
+
cache: 'no-store',
|
|
53
|
+
});
|
|
54
|
+
if (response.status === 409)
|
|
55
|
+
announce();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
announce();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
23
61
|
if (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {
|
|
24
62
|
navigator.serviceWorker.addEventListener('message', (event) => {
|
|
25
63
|
if (event.data?.type === 'rsc-kit:updated')
|
|
26
|
-
|
|
64
|
+
void confirm();
|
|
27
65
|
});
|
|
28
66
|
// A worker that took control after this page loaded is the same news by
|
|
29
67
|
// another route — it fires when the page was open across a deploy and the
|
|
@@ -33,12 +71,20 @@ if (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {
|
|
|
33
71
|
const controlledAtLoad = navigator.serviceWorker.controller !== null;
|
|
34
72
|
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
|
35
73
|
if (controlledAtLoad)
|
|
36
|
-
|
|
74
|
+
void confirm();
|
|
37
75
|
});
|
|
38
76
|
}
|
|
39
77
|
export function isUpdated() {
|
|
40
78
|
return updated;
|
|
41
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* The server said so itself - a 409 to this page's build on a request the
|
|
82
|
+
* visitor did not make. No confirmation needed: the answer is the
|
|
83
|
+
* confirmation. The next navigation is a document load.
|
|
84
|
+
*/
|
|
85
|
+
export function markStale() {
|
|
86
|
+
announce();
|
|
87
|
+
}
|
|
42
88
|
export function subscribeToUpdates(callback) {
|
|
43
89
|
listeners.add(callback);
|
|
44
90
|
return () => listeners.delete(callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateStore.js","sourceRoot":"","sources":["../../src/js/updateStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,IAAI,OAAO,GAAG,KAAK,CAAA;AACnB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,yEAAyE;AACzE,SAAS,QAAQ;IACf,IAAI,OAAO;QAAE,OAAM;IAEnB,OAAO,GAAG,IAAI,CAAA;IACd,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AACjC,CAAC;AAED,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,eAAe,IAAI,SAAS,EAAE,CAAC;IACrE,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAmB,EAAE,EAAE;QAC1E,IAAK,KAAK,CAAC,IAAiC,EAAE,IAAI,KAAK,iBAAiB;YAAE,
|
|
1
|
+
{"version":3,"file":"updateStore.js","sourceRoot":"","sources":["../../src/js/updateStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,IAAI,OAAO,GAAG,KAAK,CAAA;AACnB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,yEAAyE;AACzE,SAAS,QAAQ;IACf,IAAI,OAAO;QAAE,OAAM;IAEnB,OAAO,GAAG,IAAI,CAAA;IACd,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AACjC,CAAC;AAED;;;;;;;GAOG;AACH,IAAI,UAAU,GAAyB,IAAI,CAAA;AAE3C,KAAK,UAAU,OAAO;IACpB,wEAAwE;IACxE,gEAAgE;I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,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChE,IAAI,gBAAgB;YAAE,KAAK,OAAO,EAAE,CAAA;IACtC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS;IACvB,QAAQ,EAAE,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAoB;IACrD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAEvB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACzC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["/**\n * Whether a newer build is live while this page is still running the old one.\n *\n * Free of React for the same reason onlineStore is: the value arrives from a\n * service worker message, which has nothing to do with rendering, and the hook\n * that reads it lives next door.\n *\n * The situation it reports is real rather than theoretical. This package's\n * worker activates immediately rather than waiting for every tab to close, and\n * activating sweeps the previous build's cache — so a page that has been open\n * across a deploy is running javascript whose remaining chunks are gone. It\n * works until it navigates somewhere that needs one.\n */\n\nlet updated = false\nconst listeners = new Set<() => void>()\n\n/** A boolean, so React compares snapshots by value and does not loop. */\nfunction announce(): void {\n if (updated) return\n\n updated = true\n listeners.forEach((fn) => fn())\n}\n\n/**\n * The worker's news is about the worker: a newer one took over. Whether\n * this PAGE is stale is a different question, and the server answers it -\n * a page loaded from the network while the new worker was still installing\n * is already the new build, and told to reload it reloaded into itself.\n * One request, with the build the document says it is: 409 is stale, 200\n * is current, and no answer at all is treated as stale, the safe reading.\n */\nlet confirming: Promise<void> | null = null\n\nasync function confirm(): Promise<void> {\n // One deploy is two signals - the worker's message and controllerchange\n // - and was two requests. One in flight at a time answers both.\n if (updated) return\n if (confirming) return confirming\n\n confirming = ask().finally(() => {\n confirming = null\n })\n\n return confirming\n}\n\nasync function ask(): Promise<void> {\n const build = document.querySelector('meta[name=\"rsc-kit:build\"]')?.getAttribute('content')\n\n if (!build) return announce()\n\n try {\n const response = await fetch(window.location.href, {\n method: 'HEAD',\n headers: { 'X-RSC': '1', 'X-RSC-Version': build },\n cache: 'no-store',\n })\n\n if (response.status === 409) announce()\n } catch {\n announce()\n }\n}\n\nif (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {\n navigator.serviceWorker.addEventListener('message', (event: MessageEvent) => {\n if ((event.data as { type?: string } | null)?.type === 'rsc-kit:updated') void confirm()\n })\n\n // A worker that took control after this page loaded is the same news by\n // another route — it fires when the page was open across a deploy and the\n // message was posted before this listener existed. Only when a worker was\n // already in control when the page loaded: the first worker a visitor ever\n // gets claims the page too, and that is an install, not an update.\n const controlledAtLoad = navigator.serviceWorker.controller !== null\n\n navigator.serviceWorker.addEventListener('controllerchange', () => {\n if (controlledAtLoad) void confirm()\n })\n}\n\nexport function isUpdated(): boolean {\n return updated\n}\n\n/**\n * The server said so itself - a 409 to this page's build on a request the\n * visitor did not make. No confirmation needed: the answer is the\n * confirmation. The next navigation is a document load.\n */\nexport function markStale(): void {\n announce()\n}\n\nexport function subscribeToUpdates(callback: () => void): () => void {\n listeners.add(callback)\n\n return () => listeners.delete(callback)\n}\n\n/** The server render's answer. A fresh document is by definition not stale. */\nexport function updatedOnServer(): boolean {\n return false\n}\n"]}
|