mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
7e741b4207
### Why?
`test/e2e/app-dir/catch-error/catch-error-react-compiler.test.ts` is
skipped in CI due to incompatibility with React 18 tests.
```
Module not found: Can't resolve 'react/compiler-runtime'
> 1 | import { c as _c } from "react/compiler-runtime";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Failed CI:
https://github.com/vercel/next.js/actions/runs/23170738194/job/67327462789#step:36:317
x-ref:
https://react.dev/reference/react-compiler/target#targeting-react-17-or-18
---------
Co-authored-by: Sebastian "Sebbie" Silbermann <12292047+eps1lon@users.noreply.github.com>
Co-authored-by: Benjamin Woodruff <180404+bgw@users.noreply.github.com>
Co-authored-by: Sebastian Silbermann <eps1lon@users.noreply.github.com>
30 lines
611 B
TypeScript
30 lines
611 B
TypeScript
import { Profiler, useReducer } from 'react'
|
|
|
|
if (typeof window !== 'undefined') {
|
|
;(window as any).staticChildRenders = 0
|
|
}
|
|
|
|
function StaticChild() {
|
|
return (
|
|
<Profiler
|
|
onRender={(id, phase) => {
|
|
;(window as any).staticChildRenders += 1
|
|
}}
|
|
id="test"
|
|
>
|
|
<div>static child</div>
|
|
</Profiler>
|
|
)
|
|
}
|
|
|
|
export default function Page() {
|
|
const [count, increment] = useReducer((n) => n + 1, 1)
|
|
return (
|
|
<>
|
|
<div data-testid="parent-commits">Parent commits: {count}</div>
|
|
<button onClick={increment}>Increment</button>
|
|
<StaticChild />
|
|
</>
|
|
)
|
|
}
|