Skip to content

Commit

Permalink
Update RSC detection in minimal mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 18, 2022
1 parent cf1c0b6 commit 10f1200
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/next/server/base-server.ts
Expand Up @@ -483,6 +483,16 @@ export default abstract class Server<ServerOptions extends Options = Options> {
if (typeof parsedUrl.query === 'string') {
parsedUrl.query = parseQs(parsedUrl.query)
}
// in minimal mode we detect RSC revalidate if the .rsc path is requested
if (
this.minimalMode &&
(req.url.endsWith('.rsc') ||
(typeof req.headers['x-matched-path'] === 'string' &&
req.headers['x-matched-path'].endsWith('.rsc')))
) {
parsedUrl.query.__nextDataReq = '1'
}

req.url = normalizeRscPath(req.url, this.hasAppDir)
parsedUrl.pathname = normalizeRscPath(
parsedUrl.pathname || '',
Expand Down Expand Up @@ -1042,7 +1052,9 @@ export default abstract class Server<ServerOptions extends Options = Options> {
)

if (isSSG && req.headers['__rsc__']) {
isDataReq = true
if (!this.minimalMode) {
isDataReq = true
}
// strip header so we generate HTML still
if (
opts.runtime !== 'experimental-edge' ||
Expand Down

0 comments on commit 10f1200

Please sign in to comment.