Skip to content

Commit 8d1b0d7

Browse files
committed
Upgrade to stable react compiler
Upgrade to latest
1 parent d9e3504 commit 8d1b0d7

File tree

8 files changed

+14
-20
lines changed

8 files changed

+14
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"asyncro": "^3.0.0",
6464
"autoprefixer": "^10.4.2",
6565
"babel-eslint": "10.x",
66-
"babel-plugin-react-compiler": "^19.1.0-rc.3",
66+
"babel-plugin-react-compiler": "^1.0.0",
6767
"chalk": "4.1.2",
6868
"eslint": "7.x",
6969
"eslint-config-next": "12.0.3",

src/content/learn/react-compiler/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ React Compiler automatically optimizes your React application at build time. Rea
2828

2929
Without the compiler, you need to manually memoize components and values to optimize re-renders:
3030

31-
```js {expectedErrors: {'react-compiler': [4]}}
31+
```js
3232
import { useMemo, useCallback, memo } from 'react';
3333

3434
const ExpensiveComponent = memo(function ExpensiveComponent({ data, onClick }) {

src/content/learn/you-might-not-need-an-effect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ Remove the state variable and the Effect, and instead add a `useMemo` call to ca
11061106
11071107
<Sandpack>
11081108
1109-
```js {expectedErrors: {'react-compiler': [8]}}
1109+
```js
11101110
import { useState, useMemo } from 'react';
11111111
import { initialTodos, createTodo, getVisibleTodos } from './todos.js';
11121112

src/content/reference/eslint-plugin-react-hooks/lints/set-state-in-effect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function Component({selectedId, items}) {
7878

7979
Examples of correct code for this rule:
8080

81-
```js {expectedErrors: {'react-compiler': [8]}}
81+
```js
8282
// ✅ setState in an effect is fine if the value comes from a ref
8383
function Tooltip() {
8484
const ref = useRef(null);

src/content/reference/react-dom/createPortal.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ Here is a complete example you can play with:
398398
}
399399
```
400400

401-
{/* TODO(@poteto) - fixed by https://github.com/facebook/react/pull/34462. need a new release */}
402-
```js {expectedErrors: {'react-compiler': [15]}} src/App.js
401+
```js
403402
import { useRef, useEffect, useState } from 'react';
404403
import { createPortal } from 'react-dom';
405404
import { createMapWidget, addPopupToMapWidget } from './map-widget.js';

src/content/reference/react/useLayoutEffect.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ To do this, you need to render in two passes:
8787
8888
**All of this needs to happen before the browser repaints the screen.** You don't want the user to see the tooltip moving. Call `useLayoutEffect` to perform the layout measurements before the browser repaints the screen:
8989
90-
{/* TODO(@poteto) - fixed by https://github.com/facebook/react/pull/34462. need a new release */}
91-
```js {expectedErrors: {'react-compiler': [7]}} {5-8}
90+
```js
9291
function Tooltip() {
9392
const ref = useRef(null);
9493
const [tooltipHeight, setTooltipHeight] = useState(0); // You don't know real height yet
@@ -188,8 +187,7 @@ export default function ButtonWithTooltip({ tooltipContent, ...rest }) {
188187
}
189188
```
190189
191-
{/* TODO(@poteto) - fixed by https://github.com/facebook/react/pull/34462. need a new release */}
192-
```js {expectedErrors: {'react-compiler': [11]}} src/Tooltip.js active
190+
```js
193191
import { useRef, useLayoutEffect, useState } from 'react';
194192
import { createPortal } from 'react-dom';
195193
import TooltipContainer from './TooltipContainer.js';
@@ -339,8 +337,7 @@ export default function ButtonWithTooltip({ tooltipContent, ...rest }) {
339337
}
340338
```
341339
342-
{/* TODO(@poteto) - fixed by https://github.com/facebook/react/pull/34462. need a new release */}
343-
```js {expectedErrors: {'react-compiler': [11]}} src/Tooltip.js active
340+
```js
344341
import { useRef, useLayoutEffect, useState } from 'react';
345342
import { createPortal } from 'react-dom';
346343
import TooltipContainer from './TooltipContainer.js';
@@ -487,8 +484,7 @@ export default function ButtonWithTooltip({ tooltipContent, ...rest }) {
487484
}
488485
```
489486
490-
{/* TODO(@poteto) - fixed by https://github.com/facebook/react/pull/34462. need a new release */}
491-
```js {expectedErrors: {'react-compiler': [11]}} src/Tooltip.js active
487+
```js
492488
import { useRef, useEffect, useState } from 'react';
493489
import { createPortal } from 'react-dom';
494490
import TooltipContainer from './TooltipContainer.js';

src/content/reference/react/useMemo.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ export default function App() {
225225

226226
```
227227

228-
{/* TODO(@poteto) - investigate potential false positives in react compiler validation */}
229-
```js {expectedErrors: {'react-compiler': [5]}} src/TodoList.js active
228+
```js
230229
import { useMemo } from 'react';
231230
import { filterTodos } from './utils.js'
232231

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,10 +2273,10 @@ babel-plugin-dynamic-import-node@^2.3.3:
22732273
dependencies:
22742274
object.assign "^4.1.0"
22752275

2276-
babel-plugin-react-compiler@^19.1.0-rc.3:
2277-
version "19.1.0-rc.3"
2278-
resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.1.0-rc.3.tgz#45e5a282a2460b3701971e5eb8310a90a7919022"
2279-
integrity sha512-mjRn69WuTz4adL0bXGx8Rsyk1086zFJeKmes6aK0xPuK3aaXmDJdLHqwKKMrpm6KAI1MCoUK72d2VeqQbu8YIA==
2276+
babel-plugin-react-compiler@^1.0.0:
2277+
version "1.0.0"
2278+
resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-1.0.0.tgz#bdf7360a23a4d5ebfca090255da3893efd07425f"
2279+
integrity sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==
22802280
dependencies:
22812281
"@babel/types" "^7.26.0"
22822282

0 commit comments

Comments
 (0)