mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## What? Rename `experimental.dynamicIO` to `experimental.cacheComponents` across the Next.js codebase. ## Why? We're going to be merging the functionality of the `ppr`, `dynamicIO` and `useCache` experimental flags into the singular `cacheComponents` flag to reduce complexity of the codebase and simplify adoption for users wanting to experiment with experimental features. ## How? - Renamed the configuration option from `experimental.dynamicIO` to `experimental.cacheComponents` - Added deprecation handling with automatic migration for the old option name - Updated all documentation, tests, and internal references - Updated Rust code in SWC transforms and Turbopack - Maintained backward compatibility with deprecation warnings NAR-158
91 lines
3.0 KiB
TypeScript
91 lines
3.0 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import {
|
|
getRedboxDescription,
|
|
openRedbox,
|
|
assertNoRedbox,
|
|
retry,
|
|
} from 'next-test-utils'
|
|
|
|
describe('Cache Components Dev Errors', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should not show a red box error on the SSR render', async () => {
|
|
const browser = await next.browser('/cached')
|
|
await assertNoRedbox(browser)
|
|
let latestValue = await browser.elementByCss('#value').text()
|
|
|
|
await browser.refresh()
|
|
await assertNoRedbox(browser)
|
|
let priorValue = latestValue
|
|
latestValue = await browser.elementByCss('#value').text()
|
|
|
|
expect(latestValue).toBe(priorValue)
|
|
|
|
await browser.elementByCss('#refresh').click()
|
|
await retry(async () => {
|
|
await assertNoRedbox(browser)
|
|
let priorValue = latestValue
|
|
latestValue = await browser.elementByCss('#value').text()
|
|
expect(latestValue).not.toBe(priorValue)
|
|
})
|
|
|
|
await browser.elementByCss('#refresh').click()
|
|
await retry(async () => {
|
|
await assertNoRedbox(browser)
|
|
let priorValue = latestValue
|
|
latestValue = await browser.elementByCss('#value').text()
|
|
expect(latestValue).not.toBe(priorValue)
|
|
})
|
|
|
|
// TODO CI is too flakey to run tests like this b/c timing cannot be controlled.
|
|
// we need to land this so we're deactivating these assertions for now.
|
|
// you should be able to reproduce the assertions below when testing locally
|
|
|
|
// await browser.elementByCss('#reload').click()
|
|
// await retry(async () => {
|
|
// await assertNoRedbox(browser)
|
|
// let priorValue = latestValue
|
|
// latestValue = await browser.elementByCss('#value').text()
|
|
// expect(latestValue).toBe(priorValue)
|
|
// })
|
|
|
|
// await browser.elementByCss('#reload').click()
|
|
// await retry(async () => {
|
|
// await assertNoRedbox(browser)
|
|
// let priorValue = latestValue
|
|
// latestValue = await browser.elementByCss('#value').text()
|
|
// expect(latestValue).toBe(priorValue)
|
|
// })
|
|
|
|
// await browser.elementByCss('#refresh').click()
|
|
// await retry(async () => {
|
|
// await assertNoRedbox(browser)
|
|
// let priorValue = latestValue
|
|
// latestValue = await browser.elementByCss('#value').text()
|
|
// expect(latestValue).not.toBe(priorValue)
|
|
// })g
|
|
})
|
|
|
|
it('should show a red box error on the SSR render when data is uncached', async () => {
|
|
let desc
|
|
|
|
const browser = await next.browser('/uncached')
|
|
await openRedbox(browser)
|
|
desc = await getRedboxDescription(browser)
|
|
|
|
expect(desc).toContain(
|
|
'Route "/uncached": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it'
|
|
)
|
|
|
|
await browser.refresh()
|
|
await openRedbox(browser)
|
|
desc = await getRedboxDescription(browser)
|
|
|
|
expect(desc).toContain(
|
|
'Route "/uncached": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it'
|
|
)
|
|
})
|
|
})
|