Skip to content

Commit 81e830e

Browse files
authored
[test] Avoid hydration errors in react-compiler tests (vercel#74928)
1 parent c2df76f commit 81e830e

5 files changed

Lines changed: 20 additions & 101 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"alex": "9.1.0",
133133
"amphtml-validator": "1.0.38",
134134
"async-sema": "3.0.1",
135-
"babel-plugin-react-compiler": "0.0.0-experimental-c23de8d-20240515",
135+
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
136136
"browserslist": "4.22.2",
137137
"buffer": "5.6.0",
138138
"cheerio": "0.22.0",

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"assert": "2.0.0",
228228
"async-retry": "1.2.3",
229229
"async-sema": "3.0.0",
230-
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
230+
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
231231
"babel-plugin-transform-define": "2.0.0",
232232
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
233233
"browserify-zlib": "0.2.0",

pnpm-lock.yaml

Lines changed: 7 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/react-compiler/app/page.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
'use client'
22

3+
import { useEffect } from 'react'
4+
35
export default function Page() {
4-
let heading: any = ''
6+
let $_: any
57
if (typeof window !== 'undefined') {
68
// eslint-disable-next-line no-eval
7-
const $_ = eval('$')
9+
$_ = eval('$')
10+
}
811

12+
useEffect(() => {
913
if (Array.isArray($_)) {
10-
heading = (
11-
<h1 id="react-compiler-enabled-message">
12-
{/* @ts-ignore */}
13-
React compiler is enabled with <strong>{$_.length}</strong> memo slots
14-
</h1>
15-
)
14+
document.getElementById('react-compiler-enabled-message')!.textContent =
15+
`React compiler is enabled with ${$_!.length} memo slots`
1616
}
17-
}
17+
})
1818

1919
return (
2020
<>
2121
<div>
22-
{heading}
22+
<h1 id="react-compiler-enabled-message" />
2323
<p>hello world</p>
2424
</div>
2525
</>

test/e2e/react-compiler/react-compiler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe.each(
4040
},
4141

4242
dependencies: {
43-
'babel-plugin-react-compiler': '0.0.0-experimental-4690415-20240515',
43+
'babel-plugin-react-compiler': '19.0.0-beta-e552027-20250112',
4444
...dependencies,
4545
},
4646
})

0 commit comments

Comments
 (0)