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

[v4] Fallback to full reload if React version doesn't support Fast Refresh #9820

Closed
wants to merge 1 commit into from

Conversation

n3tr
Copy link
Contributor

@n3tr n3tr commented Oct 17, 2020

Changes

Fallback to the full reload if React version doesn't support Fast Refresh

  • Overwrite FAST_REFRESH to false if the current react version doesn't support (< 16.10.0)
  • Remove Fast Refresh warning on the older react version since we will automatically fallback to do full reload.

Verify steps

Default setup

  • yarn create-react-app my-app
  • yarn start
  • Modify App.js content
  • The app gets updated through Fast Refresh

FAST_REFRESH=false

  • Start the app by using FAST_REFRESH=false yarn start
  • Modify App.js
  • The app should do a full reload

React version that Fast Refresh is unavailable (e.g. 15)

  • Change React version to 15.7.0
    • yarn add react@15.7.0 react-dom@15.7.0
    • Remove <React.StrictMode> from index.js
  • yarn start and
  • Modify App.js
  • The app should do a full reload

- Remove FR warning for older react version
@n3tr n3tr force-pushed the fix-reload-when-fr-disabled branch from a806e97 to 0d63f72 Compare October 22, 2020 15:40
@n3tr n3tr changed the title Fallback to full reload if React version doesn't support Fast Refresh [v4] Fallback to full reload if React version doesn't support Fast Refresh Oct 24, 2020
@ianschmitz
Copy link
Contributor

We took a different approach in #9861 by attempting to import react/jsx-runtime as recommended by the React team. They have back-ported support to a number of major releases.

Thanks for the PR!

@ianschmitz ianschmitz closed this Oct 26, 2020
Copy link

@kokolay410 kokolay410 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n3tr
Copy link
Contributor Author

n3tr commented Oct 27, 2020

@ianschmitz I think this one is different from #9861, as I understand, #9861 is about jsx-runtime.

This is more about detecting if the React version supports Fast Refresh or not, otherwise, it will fall back to full reload.

@ianschmitz
Copy link
Contributor

Ah, apologies I confused the two.

@n3tr
Copy link
Contributor Author

n3tr commented Oct 27, 2020

@ianschmitz Dun worry! 😄 Should I create another PR for this or just leave it here?

@n3tr
Copy link
Contributor Author

n3tr commented Oct 31, 2020

@ianschmitz

I moved to #9971 since this has duplicated fixes with others, and I have messed up this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants