Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const nextConfig = {
experimental: {
dynamicIO: true,
ppr: true,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const nextConfig = {
experimental: {
dynamicIO: true,
ppr: true,
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
experimental: {
dynamicIO: true,
ppr: true,
},
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
experimental: {
dynamicIO: true,
ppr: true,
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
prerenderEarlyExit: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ describe('async imports in dynamicIO', () => {
await next.readFile('.next/prerender-manifest.json')
)

let prerenderedRoutes = Object.keys(prerenderManifest.routes).sort()

if (process.env.__NEXT_EXPERIMENTAL_PPR === 'true') {
// For the purpose of this test we don't consider an incomplete shell.
prerenderedRoutes = prerenderedRoutes.filter((route) => {
// For the purpose of this test we don't consider an incomplete shell.
const prerenderedRoutes = Object.keys(prerenderManifest.routes)
.sort()
.filter((route) => {
const filename = route.replace(/^\//, '').replace(/^$/, 'index')
try {
return next
Expand All @@ -37,7 +36,6 @@ describe('async imports in dynamicIO', () => {
}
}
})
}

expect(prerenderedRoutes).toMatchInlineSnapshot(`
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
},
serverExternalPackages: ['external-esm-pkg-with-async-import'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { nextTestSetup } from 'e2e-utils'

const WITH_PPR = !!process.env.__NEXT_EXPERIMENTAL_PPR

const stackStart = /\s+at /

function createExpectError(cliOutput: string) {
Expand Down Expand Up @@ -75,15 +73,9 @@ function runTests(options: { withMinification: boolean }) {
throw new Error('expected build not to fail for fully static project')
}

if (WITH_PPR) {
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
} else {
expect(next.cliOutput).toContain('ƒ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(0)
}
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { nextTestSetup } from 'e2e-utils'

const WITH_PPR = !!process.env.__NEXT_EXPERIMENTAL_PPR

const stackStart = /\s+at /

function createExpectError(cliOutput: string) {
Expand Down Expand Up @@ -75,15 +73,9 @@ function runTests(options: { withMinification: boolean }) {
throw new Error('expected build not to fail for fully static project')
}

if (WITH_PPR) {
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
} else {
expect(next.cliOutput).toContain('ƒ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
}
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
})

Expand Down Expand Up @@ -162,15 +154,9 @@ function runTests(options: { withMinification: boolean }) {
throw new Error('expected build not to fail for fully static project')
}

if (WITH_PPR) {
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
} else {
expect(next.cliOutput).toContain('ƒ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(0)
}
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
})

Expand Down Expand Up @@ -249,15 +235,9 @@ function runTests(options: { withMinification: boolean }) {
throw new Error('expected build not to fail for fully static project')
}

if (WITH_PPR) {
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
} else {
expect(next.cliOutput).toContain('ƒ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(0)
}
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
})

Expand Down
71 changes: 20 additions & 51 deletions test/e2e/app-dir/dynamic-io-errors/dynamic-io-errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { nextTestSetup } from 'e2e-utils'

const WITH_PPR = !!process.env.__NEXT_EXPERIMENTAL_PPR

const stackStart = /\s+at /

function createExpectError(cliOutput: string) {
Expand Down Expand Up @@ -205,16 +203,10 @@ function runTests(options: { withMinification: boolean }) {
throw new Error('expected build not to fail for fully static project')
}

if (WITH_PPR) {
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('#dynamic').text()).toBe('Dynamic')
expect($('[data-fallback]').length).toBe(1)
} else {
expect(next.cliOutput).toContain('ƒ / ')
const $ = await next.render$('/')
expect($('#dynamic').text()).toBe('Dynamic')
}
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('#dynamic').text()).toBe('Dynamic')
expect($('[data-fallback]').length).toBe(1)
})
})

Expand Down Expand Up @@ -379,16 +371,11 @@ function runTests(options: { withMinification: boolean }) {
// Turbopack doesn't support disabling minification yet
withMinification || isTurbopack ? undefined : 'IndirectionTwo'
)
if (WITH_PPR) {
// React currently fatals the render in canary because we don't have access to the prerender API there. with a fatal only
// one task actually reports and error at the moment. We should fix upstream but for now we exclude the second error when PPR is off
// because we are using canary React and renderToReadableStream rather than experimental React and prerender
expectError(
'Route "/": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it.',
// Turbopack doesn't support disabling minification yet
withMinification || isTurbopack ? undefined : 'IndirectionThree'
)
}
expectError(
'Route "/": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it.',
// Turbopack doesn't support disabling minification yet
withMinification || isTurbopack ? undefined : 'IndirectionThree'
)
expectError('Error occurred prerendering page "/"')
expectError('exiting the build.')
})
Expand Down Expand Up @@ -421,36 +408,18 @@ function runTests(options: { withMinification: boolean }) {
}
})

if (WITH_PPR) {
it('should partially prerender when all dynamic components are inside a Suspense boundary', async () => {
try {
await next.start()
} catch {
throw new Error(
'expected build not to fail for fully static project'
)
// we expect the build to fail
}

expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
} else {
it('should not error the build when all dynamic components are inside a Suspense boundary', async () => {
try {
await next.start()
} catch {
throw new Error(
'expected build not to fail for fully static project'
)
}
it('should partially prerender when all dynamic components are inside a Suspense boundary', async () => {
try {
await next.start()
} catch {
throw new Error('expected build not to fail for fully static project')
// we expect the build to fail
}

expect(next.cliOutput).toContain('ƒ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
}
expect(next.cliOutput).toContain('◐ / ')
const $ = await next.render$('/')
expect($('[data-fallback]').length).toBe(2)
})
})
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
pprFallbacks: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
dynamicIO: true,
serverMinification: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const nextConfig = {
experimental: {
ppr: process.env.__NEXT_EXPERIMENTAL_PPR === 'true',
ppr: true,
dynamicIO: true,
serverMinification: true,
},
Expand Down
Loading