Skip to content

Commit

Permalink
Revert "fix(next): global not-found not working on multi-root layouts" (
Browse files Browse the repository at this point in the history
#64601)

Reverts #63053.

Closes NEXT-3135
  • Loading branch information
shuding committed Apr 17, 2024
1 parent bc1d190 commit 754fada
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 104 deletions.
6 changes: 2 additions & 4 deletions packages/next/src/build/webpack/loaders/next-app-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ async function createTreeCodeFromPath(

const isDefaultNotFound = isAppBuiltinNotFoundPage(pagePath)
const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]
const rootNotFound = await resolver(
const hasRootNotFound = await resolver(
`${appDirPrefix}/${FILE_TYPES['not-found']}`
)
const hasRootNotFound = Boolean(rootNotFound)
const pages: string[] = []

let rootLayout: string | undefined
Expand Down Expand Up @@ -383,8 +382,7 @@ async function createTreeCodeFromPath(
)?.[1]
rootLayout = layoutPath

const isRootNotFound = hasRootNotFound && isRootLayer && isNotFoundRoute
if ((isRootNotFound || isDefaultNotFound) && !layoutPath) {
if (isDefaultNotFound && !layoutPath && !rootLayout) {
rootLayout = defaultLayoutPath
definedFilePaths.push(['layout', rootLayout])
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions test/e2e/app-dir/not-found/multi-root-layout/index.test.ts

This file was deleted.

12 changes: 0 additions & 12 deletions test/turbopack-build-tests-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2164,18 +2164,6 @@
"flakey": [],
"runtimeError": false
},
"test/e2e/app-dir/not-found/multi-root-layout/index.test.ts": {
"passed": [
"not-found-multi-root-layout should render main not-found",
"not-found-multi-root-layout should render sub not-found"
],
"failed": [
"not-found-multi-root-layout should render root not-found for uncaught routes"
],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/e2e/app-dir/pages-to-app-routing/pages-to-app-routing.test.ts": {
"passed": ["pages-to-app-routing should work using browser"],
"failed": [],
Expand Down
9 changes: 0 additions & 9 deletions test/turbopack-dev-tests-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1531,15 +1531,6 @@
"flakey": [],
"runtimeError": false
},
"test/development/app-dir/root-not-found-missing-root-layout/index.test.ts": {
"passed": [],
"failed": [
"root-not-found-missing-root-layout should not conflict with generated layout on dev server"
],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/development/app-dir/strict-mode-enabled-by-default/strict-mode-enabled-by-default.test.ts": {
"passed": ["Strict Mode enabled by default should work using browser"],
"failed": [],
Expand Down

0 comments on commit 754fada

Please sign in to comment.