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

feat(gatsby): update react-hot-loader dependency to enable hooks #10259

Merged
merged 3 commits into from Dec 4, 2018

Conversation

DSchau
Copy link
Contributor

@DSchau DSchau commented Dec 3, 2018

Fixes #9881, Fixes #9489

This PR updates a dependency, and some minor changes in gatsby core, to enable hot reloading of React hooks code, as well as some IE 11 fixes.

As best as I can tell, the manual setConfig is required to be called, but it's possible this may change in the future. See gaearon/react-hot-loader#1088 (comment) for more info.

@DSchau DSchau requested a review from a team as a code owner December 3, 2018 17:10
Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

👍

Per a find by @pieh, this was actually _not_ working, because yarn was
using react-hot-loader@4.3.0 instead of the specified 4.5.1. With a
resolutions field (which shouldn't be necessary once this is merged)
this seems to be the fix
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

🎉

@pieh pieh merged commit bf46002 into gatsbyjs:master Dec 4, 2018
@DSchau DSchau deleted the gatsby/react-hot-loader-update branch December 4, 2018 17:38
@DSchau
Copy link
Contributor Author

DSchau commented Dec 4, 2018

Successfully published:

  • gatsby@2.0.62

@@ -13,6 +13,12 @@ import pages from "./pages.json"
window.___emitter = emitter
setApiRunnerForLoader(apiRunner)

// necessary for hot-reloading of react hooks
setConfig({
ignoreSFC: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This option, without patches in React would disable RHL for any SFC at all.
Ie anything below any SFC would lose state. Probably this is not the goal.

Use pureSFC instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
ignoreSFC: true,
pureSFC: true,

you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 👍 👍 👍
but look like pureSFC option is a bit broken in 4.5.1 - gaearon/react-hot-loader#1115

gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
…sbyjs#10259)

* chore: upgrade to latest react-hot-loader to get some fixes

* fix: get hot reloading working with 4.5.1

Per a find by @pieh, this was actually _not_ working, because yarn was
using react-hot-loader@4.3.0 instead of the specified 4.5.1. With a
resolutions field (which shouldn't be necessary once this is merged)
this seems to be the fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants