Add compatibility with React Fast Refresh
See original GitHub issueIs your feature request related to a problem? Please describe.
react-refresh
is the successor for react-hot-loader
While using Fast Refresh on a project, changes in the theme don’t trigger HMR. Which make sense, since it’s supposed to preserve the context and states.
Describe the solution you’d like It would be nice to find a way, to have HMR work on theme changes, while using this feature. Not sure how we could go around this.
Describe alternatives you’ve considered
We could mention, the compatibility issue in the docs.
Gatsby now has a FAST_REFRESH
flag, which makes it easy to break theme HMR.
Additional context You can test this out on a repro I did for another issue.
- Simply set the Fast Refresh flag to true
// gatsby-config.js
flags: {
FAST_REFRESH: true,
},
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
React Fast Refresh — The New React Hot Reloader
A Comprehensive Guide to Using React Fast Refresh. ... and add the react-refresh-webpack-plugin plugin to the Webpack configuration file.
Read more >pmmmwh/react-refresh-webpack-plugin - GitHub
An EXPERIMENTAL Webpack plugin to enable "Fast Refresh" (also known as Hot Reloading) for React components. This plugin is not 100% stable. We're...
Read more >react-refresh - npm
Fast Refresh is a feature that lets you edit React components in a running application without losing their state. It is similar to...
Read more >Basic Features: Fast Refresh - Next.js
Fast Refresh is a Next.js feature that gives you instantaneous feedback on edits made to your React components. Fast Refresh is enabled by...
Read more >What is React Fast Refresh? - Netlify
React Fast Refresh is the latest and greatest way to load components in vanilla React, Next.js 10+, Gatsby, and more!
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Essentially, without Fast Refresh, changes trigger full reload (logs above). But when using Fast Refresh, changes to the theme don’t trigger anything at all. No full reload nor HMR.
The same thing happens when the theme lives in
gatsby-plugin-theme-ui
.That theme/index.js is just a big JavaScript object with a bunch of colors and styles inside, right? How does that conflict with Fast Refresh?