dillon1000/react

Commit

[Fast Refresh] Support callthrough HOCs (#21104)

* [Fast Refresh] Support callthrough HOCs

* Add a newly failing testing to demonstrate the flaw

This shows why my initial approach doesn't make sense.

* Attach signatures at every nesting level

* Sign nested memo/forwardRef too

* Add an IIFE test

This is not a case that is important for Fast Refresh, but we shouldn't change the code semantics. This case shows the transform isn't quite correct. It's wrapping the call at the wrong place.

* Find HOCs above more precisely

This fixes a false positive that was causing an IIFE to be wrapped in the wrong place, which made the wrapping unsafe.

* Be defensive against non-components being passed to setSignature

* Fix lint
Browse files
Changed paths5 files
First-parent comparison
M packages/react-refresh/src/ReactFreshBabelPlugin.js ModifiedM packages/react-refresh/src/ReactFreshRuntime.js ModifiedM packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js ModifiedM packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js ModifiedM packages/react-refresh/src/__tests__/__snapshots__/ReactFreshBabelPlugin-test.js.snap Modified
Patch

Files changed

Rendering syntax-highlighted changes…