-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always collect static icons for all segments (#68712)
### What Collect static metadata icons from the most leaf node in the component tree, and then add them into resolved metadata icons if there's no icons presented in exported metadata ### Why Previously we collected the icons from the last item from collected metadata items as last segment in the tree. But it doesn't act like that when there's parallel routes, so we collect the last presented static metadata icons from the metadata item list and then merge into the resolved metadata at the end. Fixes #68650
- Loading branch information
Showing
11 changed files
with
98 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/metadata-icons-parallel-routes/app/@modal/default.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Modal() { | ||
return <p>modal</p> | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
test/e2e/app-dir/metadata-icons-parallel-routes/app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
test/e2e/app-dir/metadata-icons-parallel-routes/app/layout.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default function Root({ children, modal }) { | ||
return ( | ||
<html> | ||
<body> | ||
{modal} | ||
{children} | ||
</body> | ||
</html> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/metadata-icons-parallel-routes/app/nested/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>page</p> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>page</p> | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
test/e2e/app-dir/metadata-icons-parallel-routes/metadata-icons-parallel-routes.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('app-dir - metadata-icons-parallel-routes', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should present favicon with other icons when parallel routes are presented', async () => { | ||
const $ = await next.render$('/') | ||
expect($('link[type="image/x-icon"]').length).toBe(1) | ||
expect($('link[type="image/svg+xml"]').length).toBe(1) | ||
expect($('link[rel="apple-touch-icon"]').length).toBe(1) | ||
}) | ||
|
||
it('should override parent icon when both static icon presented', async () => { | ||
const $ = await next.render$('/nested') | ||
expect($('link[type="image/x-icon"]').length).toBe(1) | ||
expect($('link[rel="icon"][type="image/png"]').length).toBe(1) | ||
}) | ||
|
||
it('should inherit parent apple icon when child does not present but parent contain static apple icon', async () => { | ||
const $ = await next.render$('/nested') | ||
expect($('link[rel="apple-touch-icon"][type="image/png"]').length).toBe(1) | ||
}) | ||
}) |