-
Notifications
You must be signed in to change notification settings - Fork 384
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
HMR doesn't rerender components extended from BaseComponent #245
Comments
@igor10k Keep me posted on what you find out. If you figure out a good change, please submit a PR. I've tested the hot reloading and changing the the JSX in the render method, and hot reloading works great. |
@justin808 I made a 1-minute video showing the process and the difference when using https://dl.dropboxusercontent.com/u/2526191/react_on_rails_hmr.mov Maybe you are doing some other changes that do trigger the hot reloading. |
@igor10k We're not doing anything in particular. This sounds like a bug in the hmr. |
@justin808 so are you having the same behavior? |
@justin808 gaearon/react-transform-boilerplate#123 Fixed HMR by adding |
👏 Nice job @igor10k. Any chance that you can throw that in a document PR here: https://github.com/shakacode/react_on_rails/tree/master/docs/additional_reading We can call the file "hot-module-replacement.md". Thanks! |
I don't think that there's a need for another doc. How about just adding that |
shakacode/react_on_rails#332 discusses the issues. |
I copied down the repo yesterday and I'm seeing the same issue. Changing the |
@Marz0 {
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
plugins: [
[
'react-transform', {
superClasses: ['React.Component', 'BaseComponent', 'Component'],
transforms: [
{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module'],
},
],
},
],
],
},
}, |
Btw, I decided to get rid of |
@seoyoochan Maybe this contains the fix we need? |
@justin808 will check if this is the fix. |
@seoyoochan Any update? |
@justin808 this was not related to my issue, stylesheet hrm rendering. It seems |
This really is a one-liner with the change to Which of those two would you prefer, @justin808? |
I'm going to try out the one liner change to the config.js file and merge that if it works for me. |
See discussion: shakacode/react-webpack-rails-tutorial#245
See discussion: shakacode/react-webpack-rails-tutorial#245
I've used
foreman start -f Procfile.dev
to start the server, went tolocalhost:3000
. OpenedLayout.jsx
and tried changing some text, but nothing happened in the browser even though I see in the terminal that webpack sends thehot-update
.Then I tried replacing
extends BaseComponent
withextends React.Component
which basically means I madeshouldComponentUpdate
always returntrue
. After these changes modifyingLayout.jsx
was instantly reflected in the browser.Something is definitely wrong since HMR should do
.forceUpdate()
for every changed component and rerender the component ignoring theshouldComponentUpdate
.The text was updated successfully, but these errors were encountered: