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

Remove app routes from _devPagesManifest #43188

Merged
merged 4 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/next/server/dev/next-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,9 @@ export default class DevServer extends Server {
res
.body(
JSON.stringify({
pages: this.sortedRoutes,
pages: this.sortedRoutes?.filter(
(route) => !this.appPathRoutes![route]
),
})
)
.send()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Page() {
return (
<p id="app-text">
hello from app/dynamic-pages-route-app-overlap/app-dir/page
</p>
)
}
9 changes: 9 additions & 0 deletions test/e2e/app-dir/app/pages/dynamic-pages-route-app-overlap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Link from 'next/link'

export default function Page() {
return (
<Link id="pages-link" href="/dynamic-pages-route-app-overlap/app-dir">
To /dynamic-pages-route-app-overlap/app-dir
</Link>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Page() {
return (
<p id="pages-text">
hello from pages/dynamic-pages-route-app-overlap/[slug]
</p>
)
}
23 changes: 23 additions & 0 deletions test/e2e/app-dir/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,29 @@ describe('app dir', () => {
await browser.close()
}
})

it('should navigate to pages dynamic route from pages page if it overlaps with an app page', async () => {
const browser = await webdriver(
next.url,
'/dynamic-pages-route-app-overlap'
)

try {
// Click the link.
await browser.elementById('pages-link').click()
expect(await browser.waitForElementByCss('#pages-text').text()).toBe(
'hello from pages/dynamic-pages-route-app-overlap/[slug]'
)

// When refreshing the browser, the app page should be rendered
await browser.refresh()
expect(await browser.waitForElementByCss('#app-text').text()).toBe(
'hello from app/dynamic-pages-route-app-overlap/app-dir/page'
)
} finally {
await browser.close()
}
})
})

describe('server components', () => {
Expand Down