@rsc-kit/core 0.30.5 → 0.30.7
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/headers.d.ts +6 -0
- package/dist/headers.js +6 -0
- package/dist/headers.js.map +1 -1
- package/dist/host.d.ts +6 -0
- package/dist/host.js +30 -5
- package/dist/host.js.map +1 -1
- package/dist/js/RedirectBoundary.d.ts +9 -0
- package/dist/js/RedirectBoundary.js +60 -9
- package/dist/js/RedirectBoundary.js.map +1 -1
- package/dist/js/RouteErrorBoundary.js +6 -2
- package/dist/js/RouteErrorBoundary.js.map +1 -1
- package/dist/js/createViteRscApp.js +7 -1
- package/dist/js/createViteRscApp.js.map +1 -1
- package/dist/js/navigate.d.ts +6 -0
- package/dist/js/navigate.js +11 -3
- package/dist/js/navigate.js.map +1 -1
- package/dist/js/router.d.ts +1 -0
- package/dist/js/router.js.map +1 -1
- package/dist/manifest.d.ts +10 -0
- package/dist/manifest.js.map +1 -1
- package/dist/notFound.d.ts +2 -2
- package/dist/notFound.js +5 -4
- package/dist/notFound.js.map +1 -1
- package/dist/vite.js +76 -20
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
package/dist/headers.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export declare const HEADER: {
|
|
|
10
10
|
readonly segmentDepth: 'X-RSC-Segment-Depth';
|
|
11
11
|
/** The chain to send back next time. */
|
|
12
12
|
readonly layouts: 'X-RSC-Layouts';
|
|
13
|
+
/**
|
|
14
|
+
* On a payload request: this url's page said it does not exist, after the
|
|
15
|
+
* shell went out, and the client is asking for the not-found page to put
|
|
16
|
+
* where it was. RedirectBoundary sends it.
|
|
17
|
+
*/
|
|
18
|
+
readonly notFound: 'X-RSC-Not-Found';
|
|
13
19
|
/** Identifies the build, so a client can notice it is talking to an old one. */
|
|
14
20
|
readonly version: 'X-RSC-Version';
|
|
15
21
|
/** The slot an intercepted navigation is targeting. */
|
package/dist/headers.js
CHANGED
|
@@ -19,6 +19,12 @@ export const HEADER = {
|
|
|
19
19
|
segmentDepth: 'X-RSC-Segment-Depth',
|
|
20
20
|
/** The chain to send back next time. */
|
|
21
21
|
layouts: 'X-RSC-Layouts',
|
|
22
|
+
/**
|
|
23
|
+
* On a payload request: this url's page said it does not exist, after the
|
|
24
|
+
* shell went out, and the client is asking for the not-found page to put
|
|
25
|
+
* where it was. RedirectBoundary sends it.
|
|
26
|
+
*/
|
|
27
|
+
notFound: 'X-RSC-Not-Found',
|
|
22
28
|
/** Identifies the build, so a client can notice it is talking to an old one. */
|
|
23
29
|
version: 'X-RSC-Version',
|
|
24
30
|
/** The slot an intercepted navigation is targeting. */
|
package/dist/headers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,gCAAgC;AAChC,EAAE;AACF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;;OAGG;IACH,GAAG,EAAE,OAAO;IAEZ,iFAAiF;IACjF,QAAQ,EAAE,gBAAgB;IAE1B,kEAAkE;IAClE,YAAY,EAAE,qBAAqB;IAEnC,wCAAwC;IACxC,OAAO,EAAE,eAAe;IAExB,gFAAgF;IAChF,OAAO,EAAE,eAAe;IAExB,uDAAuD;IACvD,SAAS,EAAE,iBAAiB;IAE5B,gDAAgD;IAChD,OAAO,EAAE,eAAe;IAExB,uEAAuE;IACvE,UAAU,EAAE,kBAAkB;IAE9B,0CAA0C;IAC1C,MAAM,EAAE,cAAc;IAEtB;;;;;;;OAOG;IACH,QAAQ,EAAE,gBAAgB;IAE1B;;;;;;OAMG;IACH,WAAW,EAAE,oBAAoB;IAEjC;;;;;OAKG;IACH,UAAU,EAAE,cAAc;IAC1B;;;;;;;;;OASG;IACH;;;;;;;OAOG;IACH,KAAK,EAAE,aAAa;IAEpB,SAAS,EAAE,aAAa;IACxB,mEAAmE;IACnE,YAAY,EAAE,iBAAiB;IAC/B,uDAAuD;IACvD,aAAa,EAAE,kBAAkB;IACjC;;;;OAIG;IACH,SAAS,EAAE,eAAe;IAC1B,+EAA+E;IAC/E,WAAW,EAAE,eAAe;IAC5B,8FAA8F;IAC9F,UAAU,EAAE,cAAc;CAClB,CAAA;AAEV,sBAAsB;AACtB,MAAM,CAAC,MAAM,WAAW,GAAG,iCAAiC,CAAA;AAE5D,2BAA2B;AAC3B,MAAM,CAAC,MAAM,SAAS,GAAG,0BAA0B,CAAA;AAEnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,CAAC,GAAG;IACV,MAAM,CAAC,QAAQ;IACf,MAAM,CAAC,UAAU;IACjB,MAAM,CAAC,SAAS;IAChB,MAAM,CAAC,OAAO;CACf,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAA;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oCAAoC,CAAA;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,qCAAqC,CAAA","sourcesContent":["// The wire protocol, as names rather than string literals.\n//\n// A host writing these out by hand is how they drift. Two of them are not\n// negotiable at all — the client sends them or asks for them at fixed\n// addresses, and a host that spells one differently fails silently: the\n// request falls through, the decoder never runs, and a button does nothing\n// with no error on either side.\n//\n// PROTOCOL.md describes what each one means. This is the same list, importable.\n\nexport const HEADER = {\n /**\n * Present on a request for a Flight payload rather than the document. One\n * url serves both, which is why every answer must Vary on it.\n */\n rsc: 'X-RSC',\n\n /** The layout chain the client has mounted, outermost first, comma-separated. */\n segments: 'X-RSC-Segments',\n\n /** The boundary the answer replaces. 0 means a whole document. */\n segmentDepth: 'X-RSC-Segment-Depth',\n\n /** The chain to send back next time. */\n layouts: 'X-RSC-Layouts',\n\n /** Identifies the build, so a client can notice it is talking to an old one. */\n version: 'X-RSC-Version',\n\n /** The slot an intercepted navigation is targeting. */\n intercept: 'X-RSC-Intercept',\n\n /** Where the navigation or action came from. */\n referer: 'X-RSC-Referer',\n\n /** One named region of the current page to render and return alone. */\n revalidate: 'X-RSC-Revalidate',\n\n /** The server reference being invoked. */\n action: 'X-RSC-Action',\n\n /**\n * Go here instead.\n *\n * Used for a redirect the client has to perform itself: a failed action, and\n * a navigation whose render redirected. Never a 3xx for those — `fetch`\n * follows one transparently, so the client would get the destination's HTML\n * where it expected a Flight payload and decode it as one.\n */\n redirect: 'X-RSC-Redirect',\n\n /**\n * The body's real type.\n *\n * The body itself goes out as application/octet-stream so a host that parses\n * multipart cannot consume it before the action does — reading Content-Type\n * instead leaves an upload undecodable.\n */\n contentType: 'X-RSC-Content-Type',\n\n /**\n * Where the browser posts server actions.\n *\n * Not a convention this can choose: the client runtime posts here\n * unconditionally.\n */\n actionPath: '/_rsc/action',\n /**\n * Where the browser reads queries.\n *\n * A GET, and that is the whole point of it being a separate address: a POST\n * is cacheable by nothing, so a read routed through the action endpoint can\n * never be kept by an HTTP cache, a CDN or a service worker. Only functions\n * declared with `query()` are reachable here — the endpoint checks the mark\n * before invoking anything, because otherwise this address would run any\n * registered action over GET.\n */\n /**\n * Sent on every read, and required by the query endpoint.\n *\n * A GET with no unusual header is a simple request, so any page could\n * trigger one with an <img> and the visitor's cookies would ride along.\n * This header is not CORS-safelisted, so the browser preflights it — the\n * same thing that makes a POST carrying X-RSC-Action safe.\n */\n query: 'X-RSC-Query',\n\n queryPath: '/_rsc/query',\n /** Build-time shell for a PPR route, for an edge cache to hold. */\n pprShellPath: '/_rsc/ppr-shell',\n /** Finish a shell an edge cache is already serving. */\n pprResumePath: '/_rsc/ppr-resume',\n /**\n * On a refresh a change triggered: which names moved, to which versions\n * (`stock@5,orders@2`). A shared section renders once per such change, and\n * every tab asking with the same one gets that render.\n */\n changedBy: 'X-RSC-Changed',\n /** The stream a tab hears on when a name its page refreshes on has changed. */\n changesPath: '/_rsc/changes',\n /** Whether this renderer can serve: up, and its backend answering. GET only, never cached. */\n healthPath: '/_rsc/health',\n} as const\n\n/** Flight payload. */\nexport const FLIGHT_TYPE = 'text/x-component; charset=utf-8'\n\n/** A rendered document. */\nexport const HTML_TYPE = 'text/html; charset=utf-8'\n\n/**\n * Every request header that changes what a response body contains.\n *\n * One url answers with a whole document, a partial payload, a named region or\n * an interceptor depending on these — so a cache keyed on the url alone, or on\n * `X-RSC` alone, will hand one client another's answer. They are materially\n * different bodies, not variations in presentation.\n */\nexport const VARY_ON_RSC = [\n HEADER.rsc,\n HEADER.segments,\n HEADER.revalidate,\n HEADER.intercept,\n HEADER.referer,\n].join(', ')\n\n/**\n * What a response says about being stored, when it must not be.\n *\n * `Vary` alone is not enough on the platform this targets. Cloudflare ignores\n * `Vary` for everything except `Accept-Encoding`, and this package ships a\n * Workers story as a headline feature — so one url answering with a document,\n * a Flight payload, a segment and an interceptor, keyed only on the url, hands\n * one visitor another's body. Anything narrowed by a request header, and\n * anything behind a guard, says outright that it is not to be stored.\n */\nexport const PER_CLIENT = 'private, no-store'\n\n/**\n * And what a frozen, unguarded page says.\n *\n * Explicit rather than absent: with no directive at all, whether an\n * intermediary stores it comes down to that intermediary's heuristics, which\n * is not a decision this package should be leaving to chance in either\n * direction.\n */\nexport const REVALIDATE = 'public, max-age=0, must-revalidate'\n\n/**\n * And what a page rendered for one request says.\n *\n * It may have read the visitor's cookies, and nothing in the headers - which\n * leave before the render has finished - can know whether it did. So a shared\n * cache may not keep it; the visitor's own browser may, and must ask again.\n */\nexport const PER_REQUEST = 'private, max-age=0, must-revalidate'\n"]}
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,gCAAgC;AAChC,EAAE;AACF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;;OAGG;IACH,GAAG,EAAE,OAAO;IAEZ,iFAAiF;IACjF,QAAQ,EAAE,gBAAgB;IAE1B,kEAAkE;IAClE,YAAY,EAAE,qBAAqB;IAEnC,wCAAwC;IACxC,OAAO,EAAE,eAAe;IAExB;;;;OAIG;IACH,QAAQ,EAAE,iBAAiB;IAE3B,gFAAgF;IAChF,OAAO,EAAE,eAAe;IAExB,uDAAuD;IACvD,SAAS,EAAE,iBAAiB;IAE5B,gDAAgD;IAChD,OAAO,EAAE,eAAe;IAExB,uEAAuE;IACvE,UAAU,EAAE,kBAAkB;IAE9B,0CAA0C;IAC1C,MAAM,EAAE,cAAc;IAEtB;;;;;;;OAOG;IACH,QAAQ,EAAE,gBAAgB;IAE1B;;;;;;OAMG;IACH,WAAW,EAAE,oBAAoB;IAEjC;;;;;OAKG;IACH,UAAU,EAAE,cAAc;IAC1B;;;;;;;;;OASG;IACH;;;;;;;OAOG;IACH,KAAK,EAAE,aAAa;IAEpB,SAAS,EAAE,aAAa;IACxB,mEAAmE;IACnE,YAAY,EAAE,iBAAiB;IAC/B,uDAAuD;IACvD,aAAa,EAAE,kBAAkB;IACjC;;;;OAIG;IACH,SAAS,EAAE,eAAe;IAC1B,+EAA+E;IAC/E,WAAW,EAAE,eAAe;IAC5B,8FAA8F;IAC9F,UAAU,EAAE,cAAc;CAClB,CAAA;AAEV,sBAAsB;AACtB,MAAM,CAAC,MAAM,WAAW,GAAG,iCAAiC,CAAA;AAE5D,2BAA2B;AAC3B,MAAM,CAAC,MAAM,SAAS,GAAG,0BAA0B,CAAA;AAEnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,CAAC,GAAG;IACV,MAAM,CAAC,QAAQ;IACf,MAAM,CAAC,UAAU;IACjB,MAAM,CAAC,SAAS;IAChB,MAAM,CAAC,OAAO;CACf,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAA;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oCAAoC,CAAA;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,qCAAqC,CAAA","sourcesContent":["// The wire protocol, as names rather than string literals.\n//\n// A host writing these out by hand is how they drift. Two of them are not\n// negotiable at all — the client sends them or asks for them at fixed\n// addresses, and a host that spells one differently fails silently: the\n// request falls through, the decoder never runs, and a button does nothing\n// with no error on either side.\n//\n// PROTOCOL.md describes what each one means. This is the same list, importable.\n\nexport const HEADER = {\n /**\n * Present on a request for a Flight payload rather than the document. One\n * url serves both, which is why every answer must Vary on it.\n */\n rsc: 'X-RSC',\n\n /** The layout chain the client has mounted, outermost first, comma-separated. */\n segments: 'X-RSC-Segments',\n\n /** The boundary the answer replaces. 0 means a whole document. */\n segmentDepth: 'X-RSC-Segment-Depth',\n\n /** The chain to send back next time. */\n layouts: 'X-RSC-Layouts',\n\n /**\n * On a payload request: this url's page said it does not exist, after the\n * shell went out, and the client is asking for the not-found page to put\n * where it was. RedirectBoundary sends it.\n */\n notFound: 'X-RSC-Not-Found',\n\n /** Identifies the build, so a client can notice it is talking to an old one. */\n version: 'X-RSC-Version',\n\n /** The slot an intercepted navigation is targeting. */\n intercept: 'X-RSC-Intercept',\n\n /** Where the navigation or action came from. */\n referer: 'X-RSC-Referer',\n\n /** One named region of the current page to render and return alone. */\n revalidate: 'X-RSC-Revalidate',\n\n /** The server reference being invoked. */\n action: 'X-RSC-Action',\n\n /**\n * Go here instead.\n *\n * Used for a redirect the client has to perform itself: a failed action, and\n * a navigation whose render redirected. Never a 3xx for those — `fetch`\n * follows one transparently, so the client would get the destination's HTML\n * where it expected a Flight payload and decode it as one.\n */\n redirect: 'X-RSC-Redirect',\n\n /**\n * The body's real type.\n *\n * The body itself goes out as application/octet-stream so a host that parses\n * multipart cannot consume it before the action does — reading Content-Type\n * instead leaves an upload undecodable.\n */\n contentType: 'X-RSC-Content-Type',\n\n /**\n * Where the browser posts server actions.\n *\n * Not a convention this can choose: the client runtime posts here\n * unconditionally.\n */\n actionPath: '/_rsc/action',\n /**\n * Where the browser reads queries.\n *\n * A GET, and that is the whole point of it being a separate address: a POST\n * is cacheable by nothing, so a read routed through the action endpoint can\n * never be kept by an HTTP cache, a CDN or a service worker. Only functions\n * declared with `query()` are reachable here — the endpoint checks the mark\n * before invoking anything, because otherwise this address would run any\n * registered action over GET.\n */\n /**\n * Sent on every read, and required by the query endpoint.\n *\n * A GET with no unusual header is a simple request, so any page could\n * trigger one with an <img> and the visitor's cookies would ride along.\n * This header is not CORS-safelisted, so the browser preflights it — the\n * same thing that makes a POST carrying X-RSC-Action safe.\n */\n query: 'X-RSC-Query',\n\n queryPath: '/_rsc/query',\n /** Build-time shell for a PPR route, for an edge cache to hold. */\n pprShellPath: '/_rsc/ppr-shell',\n /** Finish a shell an edge cache is already serving. */\n pprResumePath: '/_rsc/ppr-resume',\n /**\n * On a refresh a change triggered: which names moved, to which versions\n * (`stock@5,orders@2`). A shared section renders once per such change, and\n * every tab asking with the same one gets that render.\n */\n changedBy: 'X-RSC-Changed',\n /** The stream a tab hears on when a name its page refreshes on has changed. */\n changesPath: '/_rsc/changes',\n /** Whether this renderer can serve: up, and its backend answering. GET only, never cached. */\n healthPath: '/_rsc/health',\n} as const\n\n/** Flight payload. */\nexport const FLIGHT_TYPE = 'text/x-component; charset=utf-8'\n\n/** A rendered document. */\nexport const HTML_TYPE = 'text/html; charset=utf-8'\n\n/**\n * Every request header that changes what a response body contains.\n *\n * One url answers with a whole document, a partial payload, a named region or\n * an interceptor depending on these — so a cache keyed on the url alone, or on\n * `X-RSC` alone, will hand one client another's answer. They are materially\n * different bodies, not variations in presentation.\n */\nexport const VARY_ON_RSC = [\n HEADER.rsc,\n HEADER.segments,\n HEADER.revalidate,\n HEADER.intercept,\n HEADER.referer,\n].join(', ')\n\n/**\n * What a response says about being stored, when it must not be.\n *\n * `Vary` alone is not enough on the platform this targets. Cloudflare ignores\n * `Vary` for everything except `Accept-Encoding`, and this package ships a\n * Workers story as a headline feature — so one url answering with a document,\n * a Flight payload, a segment and an interceptor, keyed only on the url, hands\n * one visitor another's body. Anything narrowed by a request header, and\n * anything behind a guard, says outright that it is not to be stored.\n */\nexport const PER_CLIENT = 'private, no-store'\n\n/**\n * And what a frozen, unguarded page says.\n *\n * Explicit rather than absent: with no directive at all, whether an\n * intermediary stores it comes down to that intermediary's heuristics, which\n * is not a decision this package should be leaving to chance in either\n * direction.\n */\nexport const REVALIDATE = 'public, max-age=0, must-revalidate'\n\n/**\n * And what a page rendered for one request says.\n *\n * It may have read the visitor's cookies, and nothing in the headers - which\n * leave before the render has finished - can know whether it did. So a shared\n * cache may not keep it; the visitor's own browser may, and must ask again.\n */\nexport const PER_REQUEST = 'private, max-age=0, must-revalidate'\n"]}
|
package/dist/host.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component of the route whose page or guard answered with notFound(), or
|
|
3
|
+
* undefined for a url no route owns. The entry in front asks, to find the
|
|
4
|
+
* nearest not-found.tsx above it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function notFoundRouteOf(request: Request): string | undefined;
|
|
1
7
|
/** Whether a page or guard of this app answered the request with notFound(). */
|
|
2
8
|
export declare function pageSaidNotFound(request: Request): boolean;
|
|
3
9
|
export { revalidate } from "./revalidate.js";
|
package/dist/host.js
CHANGED
|
@@ -38,10 +38,26 @@ const RENDER_NOT_FOUND = Symbol("render-not-found");
|
|
|
38
38
|
* showed. Asked with pageSaidNotFound().
|
|
39
39
|
*/
|
|
40
40
|
const notFoundRequests = new WeakSet();
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The route that said it, so not-found.tsx can be the nearest one above it.
|
|
43
|
+
*
|
|
44
|
+
* A url no route owns has none, and is answered by the root one.
|
|
45
|
+
*/
|
|
46
|
+
const notFoundFrom = new WeakMap();
|
|
47
|
+
function saidNotFound(request, route) {
|
|
42
48
|
notFoundRequests.add(request);
|
|
49
|
+
if (route !== undefined)
|
|
50
|
+
notFoundFrom.set(request, route);
|
|
43
51
|
return null;
|
|
44
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The component of the route whose page or guard answered with notFound(), or
|
|
55
|
+
* undefined for a url no route owns. The entry in front asks, to find the
|
|
56
|
+
* nearest not-found.tsx above it.
|
|
57
|
+
*/
|
|
58
|
+
export function notFoundRouteOf(request) {
|
|
59
|
+
return notFoundFrom.get(request);
|
|
60
|
+
}
|
|
45
61
|
/** Whether a page or guard of this app answered the request with notFound(). */
|
|
46
62
|
export function pageSaidNotFound(request) {
|
|
47
63
|
return notFoundRequests.has(request);
|
|
@@ -834,6 +850,15 @@ export function createRscHandler(options) {
|
|
|
834
850
|
headers: withVersion({ "X-RSC-Location": url.pathname + url.search, "Cache-Control": "no-store" }),
|
|
835
851
|
});
|
|
836
852
|
}
|
|
853
|
+
// The page said, after its shell was sent, that this url names nothing.
|
|
854
|
+
// The browser's boundary caught the mark and asks for the not-found page
|
|
855
|
+
// to show where the page was - the same answer a url no route owns gets.
|
|
856
|
+
// After the version check, so a client of another build is sent to load
|
|
857
|
+
// the document instead of being handed a tree its manifest cannot read.
|
|
858
|
+
// Anyone may ask for it: not-found.tsx is public by construction.
|
|
859
|
+
if (request.headers.get(HEADER.notFound) !== null && request.headers.get(HEADER.rsc) !== null) {
|
|
860
|
+
return saidNotFound(request, matchPage(routes, url)?.route.component);
|
|
861
|
+
}
|
|
837
862
|
// One named region of this page, asked for without mutating anything to
|
|
838
863
|
// earn it. What an action invalidated does not come through here — that
|
|
839
864
|
// travels back inside the action's own answer, which is the whole point of
|
|
@@ -864,7 +889,7 @@ export function createRscHandler(options) {
|
|
|
864
889
|
// Null, as a render that calls notFound() answers: the caller in front
|
|
865
890
|
// serves not-found.tsx with a 404, the same for a guard as for a page.
|
|
866
891
|
if (refusal === RENDER_NOT_FOUND)
|
|
867
|
-
return saidNotFound(request);
|
|
892
|
+
return saidNotFound(request, match?.route.component);
|
|
868
893
|
if (refusal)
|
|
869
894
|
return refusal;
|
|
870
895
|
const frozen = await servePrerendered(request, url, match, options.prerendered);
|
|
@@ -927,7 +952,7 @@ export function createRscHandler(options) {
|
|
|
927
952
|
// route are indistinguishable to whoever is asking — which is the
|
|
928
953
|
// point of a 404.
|
|
929
954
|
if (currentNotFound())
|
|
930
|
-
return saidNotFound(request);
|
|
955
|
+
return saidNotFound(request, match.route.component);
|
|
931
956
|
// A guard refusing is not a failed render. Without this a visitor
|
|
932
957
|
// who may not see the page gets a 500, which reads as the
|
|
933
958
|
// application being broken rather than them being turned away —
|
|
@@ -949,7 +974,7 @@ export function createRscHandler(options) {
|
|
|
949
974
|
// stays 200 because the status line has gone.
|
|
950
975
|
if (currentNotFound()) {
|
|
951
976
|
letGo();
|
|
952
|
-
return saidNotFound(request);
|
|
977
|
+
return saidNotFound(request, match.route.component);
|
|
953
978
|
}
|
|
954
979
|
// The payload beside the HTML: the browser hydrates from it rather
|
|
955
980
|
// than asking for a second render.
|
|
@@ -1000,7 +1025,7 @@ export function createRscHandler(options) {
|
|
|
1000
1025
|
// Same answer the document path gives, so a client navigating to a
|
|
1001
1026
|
// url and a browser loading it fresh agree about whether it exists.
|
|
1002
1027
|
if (currentNotFound())
|
|
1003
|
-
return saidNotFound(request);
|
|
1028
|
+
return saidNotFound(request, match.route.component);
|
|
1004
1029
|
// A payload request is guarded exactly as the document is. Narrowing
|
|
1005
1030
|
// a request must never narrow what is checked.
|
|
1006
1031
|
const status = refusalStatus(error);
|