The Wayback Machine - https://web.archive.org/web/20250408030317/https://github.com/facebook/react/issues/24710
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Fast Refresh crashed when wrapping function in memo. #24710

Closed
await-ovo opened this issue Jun 12, 2022 · 2 comments
Closed

Bug: Fast Refresh crashed when wrapping function in memo. #24710

await-ovo opened this issue Jun 12, 2022 · 2 comments
Labels
Resolution: Stale Automatically closed due to inactivity Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@await-ovo
Copy link

As described in this issue: vercel/next.js#37241

React version: ^18

Steps To Reproduce

I can reproduce this issue in next.js, react-scripts and vite, here are the reproducible repositories:

  1. change component from function to React.memo:
    edit code in Test.jsx:
export function Test() {
  return <h1>hi test</h1>;
}

change it to:

export const Test = memo(function Test() {
  return <h1>test memo</h1>;
});

you can see the error in your browser console:
image

After manually refreshing the page and changing the code back to the original, there was no error, but the hot update did not work at all.

  1. change component from function to React.forwardRef:

Same result as in step 1.

  1. change component from React.memo to React.forwardRef:

change component Test from

export const Test = memo(function Test() {
  return <h1>test memo</h1>;
});

to

export const Test = forwardRef(function Test() {
  return <h1>forward ref</h1>;
});

Hot update has no effect, the page shows the result before modification.

Link to code example:

The current behavior

As described above.

fast-refresh-issue.mp4

The expected behavior

Fast Refresh works fine when changing component types.

@await-ovo await-ovo added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jun 12, 2022
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Apr 10, 2024
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Stale Automatically closed due to inactivity Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
1 participant