Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit c94b003

Browse files
authored
Merge pull request #213 from devongovett/fix-refresh-hocs
Fix order of assignments in react refresh hocs
2 parents 3e2c3da + c7e1893 commit c94b003

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/fast_refresh.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ impl Fold for ReactRefreshFold {
856856
// ! insert (hoc)
857857
// _c = App;
858858
// _c2 = Foo;
859-
for (hoc_handle_id, hoc_id) in hocs {
859+
for (hoc_id, hoc_handle_id) in hocs {
860860
raw_items.push(ModuleItem::Stmt(Stmt::Expr(ExprStmt {
861861
span: DUMMY_SP,
862862
expr: Box::new(Expr::Assign(AssignExpr {
@@ -1291,30 +1291,30 @@ var _s = $RefreshSig$(), _s2 = $RefreshSig$();
12911291
const A = forwardRef(_c = function() {
12921292
return <h1 >Foo</h1>;
12931293
});
1294-
A = _c2;
1294+
_c2 = A;
12951295
const B = memo(_c4 = React.forwardRef(_c3 = ()=>{
12961296
return <h1 >Foo</h1>;
12971297
}));
1298-
B = _c5;
1298+
_c5 = B;
12991299
const C = forwardRef(_c8 = memo(_c7 = forwardRef(_c6 = ()=>null
13001300
)));
1301-
C = _c9;
1301+
_c9 = C;
13021302
export const D = React.memo(_c11 = React.forwardRef(_c10 = _s((props, ref)=>{
13031303
_s();
13041304
const [foo, setFoo] = useState(0);
13051305
React.useEffect(()=>{
13061306
});
13071307
return <h1 ref={ref}>{foo}</h1>;
13081308
}, "useState{[foo, setFoo](0)}\nuseEffect{}")));
1309-
D = _c12;
1309+
_c12 = D;
13101310
export const E = React.memo(_c14 = React.forwardRef(_c13 = _s2(function(props, ref) {
13111311
_s2();
13121312
const [foo, setFoo] = useState(0);
13131313
React.useEffect(()=>{
13141314
});
13151315
return <h1 ref={ref}>{foo}</h1>;
13161316
}, "useState{[foo, setFoo](0)}\nuseEffect{}")));
1317-
E = _c15;
1317+
_c15 = E;
13181318
function hoc() {
13191319
var _s3 = $RefreshSig$();
13201320
return _s3(function Inner() {

0 commit comments

Comments
 (0)