Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app dir page detection #38475

Merged
merged 4 commits into from Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/server/app-render.tsx
Expand Up @@ -480,7 +480,7 @@ export async function renderToHTML(
const Loading = loading ? interopDefault(loading()) : undefined
const layoutOrPageMod = layout ? layout() : page ? page() : undefined
// TODO: improve detection
const isPage = !firstItem && segment === ''
const isPage = typeof page !== undefined
ijjk marked this conversation as resolved.
Show resolved Hide resolved

const isClientComponentModule =
layoutOrPageMod && !layoutOrPageMod.hasOwnProperty('__next_rsc__')
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/app-dir/rsc-basic.test.ts
Expand Up @@ -155,10 +155,10 @@ describe('app dir - react server components', () => {

await browser.waitForElementByCss('#goto-next-link').click()
await new Promise((res) => setTimeout(res, 1000))
expect(await browser.url()).toBe(`${next.url}/next-api/link`)
await check(() => browser.url(), `${next.url}/next-api/link`)
await browser.waitForElementByCss('#goto-home').click()
await new Promise((res) => setTimeout(res, 1000))
expect(await browser.url()).toBe(`${next.url}/root`)
await check(() => browser.url(), `${next.url}/root`)
const content = await browser.elementByCss('body').text()
expect(content).toContain('component:root.server')

Expand All @@ -180,7 +180,7 @@ describe('app dir - react server components', () => {
expect(content).toMatchInlineSnapshot('"next_streaming_data"')
})

it.skip('should support next/link in server components', async () => {
it('should support next/link in server components', async () => {
const linkHTML = await renderViaHTTP(next.url, '/next-api/link')
const linkText = getNodeBySelector(
linkHTML,
Expand Down