forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(next): properly pass layout-level
maxDuration
config to the chi…
…ldren page segments on build (vercel#68793) > [!NOTE] > This PR is recommended to [hide whitespace](https://github.blog/news-insights/product-news/ignore-white-space-in-code-review/) when reviewing. ### What? Fixed layouts to properly pass route segment config `maxDuration` to their children page segments. ```tsx // layout.tsx export const maxDuration = 5 ``` ### Why? - We separately handle the route segment configs on different places. - `maxDuration` was missing logic to get value from the layouts unlike [other route segment configs](https://github.com/vercel/next.js/blob/canary/packages/next/src/build/utils.ts#L1636-L1652). ### How? - Instead of explicit logic for the `maxDuration`, get the route segment configs from the layout on the page's static info. - Ensure to inherit the value from the layout only if is a page segment. #### See Changes by Commits - current: 522b953 - expected: 12496d4 - fix: 196e0e8 Fixes NDX-196
- Loading branch information
1 parent
f1ca90f
commit 9150f1b
Showing
6 changed files
with
94 additions
and
60 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
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
6 changes: 6 additions & 0 deletions
6
test/e2e/app-dir/with-exported-function-config/app/app-layout/inner/page.tsx
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,6 @@ | ||
export default function Page() { | ||
return <p>app-layout</p> | ||
} | ||
|
||
// overwrite ../layout's maxDuration | ||
export const maxDuration = 2 |
5 changes: 5 additions & 0 deletions
5
test/e2e/app-dir/with-exported-function-config/app/app-layout/layout.tsx
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,5 @@ | ||
export default function Layout({ children }: { children: React.ReactNode }) { | ||
return <>{children}</> | ||
} | ||
|
||
export const maxDuration = 1 |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/with-exported-function-config/app/app-layout/page.tsx
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>app-layout</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