Comments (9)
Thanks for reporting. Any idea why this happens?
from react-transform-hmr.
I'm not entirely sure. I noticed you talking about 'router.replaceRoutes' in the past. That has been removed and I'm not sure how the router handles new props. I started to think that the router was setting routes in state and not updating when it received new props. I'm still suspicious to this but then why does adding or removing a sibling make it suddenly work?
from react-transform-hmr.
Not working with Redux-Form too actually,
As long as there are high-order component decorators, react-proxy could not catch them and therefore the hot reload would fail.
e.g.
The code
@reduxForm() class MyComponent {...}
The tree is rendered as:
ReduxFormConnector --> ReduxForm --> MyComponent.
ReduxFormConnector and MyComponent are recognized and proxied by react-proxy. So far so good. However ReduxForm will not. So when there is a new module, a new ReduxForm is rendered. Because the type is different from the old one, the old ReduxForm instance is unmounted (so is MyComponent) and then the new ReduxForm instance is mounted. Therefore the state in MyComponent lost.
Any idea how to solve this problem? My current work around is to make sure ReduxFormConnector is not proxied. So I ignore any changes in ReduxFormConnector, but any changes in MyComponent will still be hot reloaded.
from react-transform-hmr.
Just executing the module again should not affect the parent component anyway. Yes, it's not recognised, but for this reason it is just ignored, and only child component (your class) is actually updated. Is this not what happens?
from react-transform-hmr.
For babel@5, only child component is proxied (which should be good). However for babel@6 with transform-decorators-legacy, the root component is proxied (and in this case it doesn't work)
from react-transform-hmr.
The work around is instead of writing:
@reduxForm()
export default class MyComponent {...}
I need to write:
class MyComponent {...}
@reduxForm()
export default class extends MyComponent
from react-transform-hmr.
Oh okay. That's a Babel 6 plugin order issue I guess. The transform runs before the decorator transform. I think it will be fixed in Babel 7 by grouping plugin passes by preset. Don't rely on experimental language features :-)
from react-transform-hmr.
The new Babel 6.5.0 passPerPreset option might help here.
from react-transform-hmr.
I don’t see anything actionable for us here so closing. When <Router>
learns to reload its routes in componentWillReceiveProps
it will probably work again.
The Redux Form issue later in comments is completely unrelated to this issue and has to do with decorator usage. Don’t use decorators, they are far from being stable, and are too easy to break in Babel 6 because of plugin ordering issues.
from react-transform-hmr.
Related Issues (20)
- Error: locals[0] does not appear to be a `module` object with Hot Module replacement API enabled HOT 6
- chrome-devtools://devtools/ used as origin for CSS url() in Chrome and Firefox HOT 1
- Source patching is not working HOT 2
- HMR works intermittently HOT 4
- componentWillReceiveProps not working correctly in HMR HOT 1
- On Windows uses Linux VM don't run hmr HOT 1
- Error "locals[0] does not appear.." when testing jsx-files with Mocha HOT 3
- TypeError: Function.prototype.toString called on incompatible object HOT 4
- undefined value static properties outside class
- undefined value static properties outside class HOT 1
- Bug: true is not a function(evaluating 'predicate(value')
- Don't work with redux-devtools. HOT 2
- s
- Tests fail with: Warning! This doesn't currently work for stateless functional components that were introduced in React 0.14! HOT 2
- react-transform-hmr vs. webpack.HotModuleReplacementPlugin HOT 4
- Freeze/continual-reloading when Component is aliased HOT 1
- Error compiling ES6 module using react hmre with Webpack 2 RC4
- Doesn't reload components with React 16 after hot loaded changes
- Locals[0] does not appear ...
- react-transform-hmr/lib/index.js missing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-transform-hmr.