Skip to content

Commit

Permalink
Revert "Revert "Refactor Server Router" (#40328)" (#40333)
Browse files Browse the repository at this point in the history
This unreverts #40328 as it wasn't
the cause for #40241 like
initially suspected and the actual fix has been included here as well
with regression test.

Fixes: #40241

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
  • Loading branch information
ijjk committed Sep 7, 2022
1 parent b86bf07 commit 62c7eff
Show file tree
Hide file tree
Showing 4 changed files with 276 additions and 215 deletions.
6 changes: 5 additions & 1 deletion packages/next/server/base-server.ts
Expand Up @@ -959,7 +959,11 @@ export default abstract class Server<ServerOptions extends Options = Options> {

// Toggle whether or not this is a Data request
const isDataReq =
!!(query.__nextDataReq || req.headers['x-nextjs-data']) &&
!!(
query.__nextDataReq ||
(req.headers['x-nextjs-data'] &&
(this.serverOptions as any).webServerConfig)
) &&
(isSSG || hasServerProps || isServerComponent)

delete query.__nextDataReq
Expand Down
1 change: 0 additions & 1 deletion packages/next/server/dev/next-dev-server.ts
Expand Up @@ -221,7 +221,6 @@ export default class DevServer extends Server {
for (const path in exportPathMap) {
const { page, query = {} } = exportPathMap[path]

// We use unshift so that we're sure the routes is defined before Next's default routes
this.router.addFsRoute({
match: getPathMatch(path),
type: 'route',
Expand Down

0 comments on commit 62c7eff

Please sign in to comment.