Unverified Commit 192dc6ba authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure RSC is detecting correctly during revalidate (#42508)

Fixes: https://github.com/vercel/next.js/issues/42504

Patch tested against provided reproduction here
https://portfolio-pcmtikvrv-ijjk-testing.vercel.app/

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent 00e416bf
...@@ -484,13 +484,9 @@ export default abstract class Server<ServerOptions extends Options = Options> { ...@@ -484,13 +484,9 @@ export default abstract class Server<ServerOptions extends Options = Options> {
if (typeof parsedUrl.query === 'string') { if (typeof parsedUrl.query === 'string') {
parsedUrl.query = parseQs(parsedUrl.query) parsedUrl.query = parseQs(parsedUrl.query)
} }
// in minimal mode we detect RSC revalidate if the .rsc path is requested // in minimal mode we detect RSC revalidate if the .rsc
if ( // path is requested
this.minimalMode && if (this.minimalMode && req.url.endsWith('.rsc')) {
(req.url.endsWith('.rsc') ||
(typeof req.headers['x-matched-path'] === 'string' &&
req.headers['x-matched-path'].endsWith('.rsc')))
) {
parsedUrl.query.__nextDataReq = '1' parsedUrl.query.__nextDataReq = '1'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment