Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
754fadac
Unverified
Commit
754fadac
authored
Apr 17, 2024
by
Shu Ding
Committed by
GitHub
Apr 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix(next): global not-found not working on multi-root layouts" (#64601)
Reverts #63053. Closes NEXT-3135
parent
bc1d1907
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
2 additions
and
104 deletions
+2
-104
next-app-loader.ts
packages/next/src/build/webpack/loaders/next-app-loader.ts
+2
-4
not-found.tsx
...-dir/root-not-found-missing-root-layout/app/not-found.tsx
+0
-3
page.tsx
...t/app-dir/root-not-found-missing-root-layout/app/page.tsx
+0
-6
index.test.ts
.../app-dir/root-not-found-missing-root-layout/index.test.ts
+0
-13
layout.tsx
...app-dir/not-found/multi-root-layout/app/(main)/layout.tsx
+0
-7
not-found.tsx
...-dir/not-found/multi-root-layout/app/(main)/not-found.tsx
+0
-3
page.tsx
...e/app-dir/not-found/multi-root-layout/app/(main)/page.tsx
+0
-6
layout.tsx
.../app-dir/not-found/multi-root-layout/app/(sub)/layout.tsx
+0
-7
not-found.tsx
...p-dir/not-found/multi-root-layout/app/(sub)/not-found.tsx
+0
-3
page.tsx
...pp-dir/not-found/multi-root-layout/app/(sub)/sub/page.tsx
+0
-6
not-found.tsx
...e2e/app-dir/not-found/multi-root-layout/app/not-found.tsx
+0
-3
index.test.ts
test/e2e/app-dir/not-found/multi-root-layout/index.test.ts
+0
-22
turbopack-build-tests-manifest.json
test/turbopack-build-tests-manifest.json
+0
-12
turbopack-dev-tests-manifest.json
test/turbopack-dev-tests-manifest.json
+0
-9
No files found.
packages/next/src/build/webpack/loaders/next-app-loader.ts
View file @
754fadac
...
...
@@ -200,10 +200,9 @@ async function createTreeCodeFromPath(
const
isDefaultNotFound
=
isAppBuiltinNotFoundPage
(
pagePath
)
const
appDirPrefix
=
isDefaultNotFound
?
APP_DIR_ALIAS
:
splittedPath
[
0
]
const
r
ootNotFound
=
await
resolver
(
const
hasR
ootNotFound
=
await
resolver
(
`
${
appDirPrefix
}
/
${
FILE_TYPES
[
'not-found'
]}
`
)
const
hasRootNotFound
=
Boolean
(
rootNotFound
)
const
pages
:
string
[]
=
[]
let
rootLayout
:
string
|
undefined
...
...
@@ -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
])
}
...
...
test/development/app-dir/root-not-found-missing-root-layout/app/not-found.tsx
deleted
100644 → 0
View file @
bc1d1907
export
default
function
NotFound
()
{
return
<
p
>
not found
</
p
>
}
test/development/app-dir/root-not-found-missing-root-layout/app/page.tsx
deleted
100644 → 0
View file @
bc1d1907
import
{
notFound
}
from
'next/navigation'
export
default
function
Page
()
{
notFound
()
return
<
p
>
hello world
</
p
>
}
test/development/app-dir/root-not-found-missing-root-layout/index.test.ts
deleted
100644 → 0
View file @
bc1d1907
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'root-not-found-missing-root-layout'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should not conflict with generated layout on dev server'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
// eslint-disable-next-line jest/no-standalone-expect
expect
(
await
browser
.
elementByCss
(
'p'
).
text
()).
toBe
(
'not found'
)
})
})
test/e2e/app-dir/not-found/multi-root-layout/app/(main)/layout.tsx
deleted
100644 → 0
View file @
bc1d1907
export
default
function
MainRoot
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/not-found/multi-root-layout/app/(main)/not-found.tsx
deleted
100644 → 0
View file @
bc1d1907
export
default
function
MaiNotFound
()
{
return
<
h1
>
Main Not Found
</
h1
>
}
test/e2e/app-dir/not-found/multi-root-layout/app/(main)/page.tsx
deleted
100644 → 0
View file @
bc1d1907
import
{
notFound
}
from
'next/navigation'
export
default
function
Main
()
{
notFound
()
return
<
h1
>
Main
</
h1
>
}
test/e2e/app-dir/not-found/multi-root-layout/app/(sub)/layout.tsx
deleted
100644 → 0
View file @
bc1d1907
export
default
function
SubRoot
({
children
}:
{
children
:
React
.
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/not-found/multi-root-layout/app/(sub)/not-found.tsx
deleted
100644 → 0
View file @
bc1d1907
export
default
function
SubNotFound
()
{
return
<
h1
>
Sub Not Found
</
h1
>
}
test/e2e/app-dir/not-found/multi-root-layout/app/(sub)/sub/page.tsx
deleted
100644 → 0
View file @
bc1d1907
import
{
notFound
}
from
'next/navigation'
export
default
function
Sub
()
{
notFound
()
return
<
h1
>
Sub
</
h1
>
}
test/e2e/app-dir/not-found/multi-root-layout/app/not-found.tsx
deleted
100644 → 0
View file @
bc1d1907
export
default
function
RootNotFound
()
{
return
<
h1
>
Root Not Found
</
h1
>
}
test/e2e/app-dir/not-found/multi-root-layout/index.test.ts
deleted
100644 → 0
View file @
bc1d1907
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'not-found-multi-root-layout'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should render main not-found'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
expect
(
await
browser
.
elementByCss
(
'h1'
).
text
()).
toBe
(
'Main Not Found'
)
})
it
(
'should render sub not-found'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/sub'
)
expect
(
await
browser
.
elementByCss
(
'h1'
).
text
()).
toBe
(
'Sub Not Found'
)
})
it
(
'should render root not-found for uncaught routes'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/404'
)
expect
(
await
browser
.
elementByCss
(
'h1'
).
text
()).
toBe
(
'Root Not Found'
)
})
})
test/turbopack-build-tests-manifest.json
View file @
754fadac
...
...
@@ -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"
:
[],
test/turbopack-dev-tests-manifest.json
View file @
754fadac
...
...
@@ -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"
:
[],
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment