question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add compatibility with React Fast Refresh

See original GitHub issue

Is 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.

  1. Simply set the Fast Refresh flag to true
// gatsby-config.js

flags: {
  FAST_REFRESH: true,
},

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fcisiocommented, Feb 16, 2021

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.

1reaction
hasparuscommented, Feb 16, 2021

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found