Skip to content

Commit

Permalink
update checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed May 9, 2022
1 parent 69183d7 commit 1ba6d9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/next/build/webpack/loaders/next-view-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ async function resolveLayoutPathsByPage({
const layoutPaths = new Map<string, string | undefined>()
const parts = pagePath.split('/')
// if a new root is being created we shouldn't include `views/layout.js`
const shouldIncludeRootLayout = !parts.some((part) => part.match(/\(.*?\)/))
const shouldIncludeRootLayout = !parts.some(
(part) => part.startsWith('(') && part.endsWith(')')
)

for (let i = 1; i < parts.length; i++) {
if (i === 1 && !shouldIncludeRootLayout) continue
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/view-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export async function renderToHTML(
// and a root layout isn't already present views/layout.js or
// views/(new-root)/layout.js
let hasRootLayout = componentPaths.some(
(path) => path === '/' || path.match(/\/\(.*?\)\/$/)
(path) => path === '/' || path.match(/\/\(.*?\)$/)
)
const isSubtreeRender = components.length < componentPaths.length

Expand Down

0 comments on commit 1ba6d9d

Please sign in to comment.