react icon indicating copy to clipboard operation
react copied to clipboard

[React Compiler] React Fast Refresh Compatibility Issue

Open daniel-nagy opened this issue 1 month ago • 5 comments

Summary

When using the React Compiler, Fast Refresh is broken when importing a non-JavaScript file, .e.g.

import content from "./content.md";

export const App = () => {
  return <div>{content}</div>;
};

In this example, if the content of the markdown file changes, then the app does not update without a page refresh. A repo for this example can be found at https://github.com/daniel-nagy/react-compiler-bug.

From a quick investigation, the issue appears to be that the compiler memo cache is global and that it does not treat imported values as mutable.

daniel-nagy avatar May 16 '24 20:05 daniel-nagy