Unverified Commit 22bd9dec authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update PPR cases with adapter config (#83595)

Continues https://github.com/vercel/next.js/pull/82919 from testing
fixing `fallback` value missing the extension and `/` app route not
being mapping to it's output file correctly. This also adds a test suite
with PPR enabled to catch these cases.
parent 7ef02019
...@@ -795,7 +795,7 @@ export async function handleBuildComplete({ ...@@ -795,7 +795,7 @@ export async function handleBuildComplete({
let filePath = path.join( let filePath = path.join(
isAppPage ? appDistDir : pagesDistDir, isAppPage ? appDistDir : pagesDistDir,
`${route}.${isAppPage && !dataRoute ? 'body' : 'html'}` `${route === '/' ? 'index' : route}.${isAppPage && !dataRoute ? 'body' : 'html'}`
) )
// we use the static 404 for notFound: true if available // we use the static 404 for notFound: true if available
...@@ -933,7 +933,9 @@ export async function handleBuildComplete({ ...@@ -933,7 +933,9 @@ export async function handleBuildComplete({
? { ? {
filePath: path.join( filePath: path.join(
isAppPage ? appDistDir : pagesDistDir, isAppPage ? appDistDir : pagesDistDir,
fallback // app router dynamic route fallbacks don't have the
// extension so ensure it's added here
fallback.endsWith('.html') ? fallback : `${fallback}.html`
), ),
initialStatus: fallbackStatus, initialStatus: fallbackStatus,
initialHeaders: { initialHeaders: {
......
process.env.TEST_PPR = '1'
require('./adapter-config.test')
export default function Page() {
return (
<>
<p>/</p>
<p>now: {Date.now()}</p>
</>
)
}
...@@ -5,6 +5,7 @@ const require = Module.createRequire(import.meta.url) ...@@ -5,6 +5,7 @@ const require = Module.createRequire(import.meta.url)
const nextConfig = { const nextConfig = {
experimental: { experimental: {
adapterPath: require.resolve('./my-adapter.mjs'), adapterPath: require.resolve('./my-adapter.mjs'),
ppr: Boolean(process.env.TEST_PPR),
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment