-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Conversation
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Successfully published:
|
@@ -13,6 +13,12 @@ import pages from "./pages.json" | |||
window.___emitter = emitter | |||
setApiRunnerForLoader(apiRunner) | |||
|
|||
// necessary for hot-reloading of react hooks | |||
setConfig({ | |||
ignoreSFC: true, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoreSFC: true, | |
pureSFC: true, |
you mean?
There was a problem hiding this comment.
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
…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
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.