Closed GantMan closed 8 years ago
+1 - running into this , hot reloading doesnt seem to work -- just tried to update the drawer
if you update a component, it works. Any container it doesn't.
We can fix this, though.
I was just updating the Root.js or w/e playing with it and changiing the text. I added this to the Store.js and it fixed it in some places but in others I still get the issue such as within the Themes etc.
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextRootReducer = require('../Reducers/index');
store.replaceReducer(nextRootReducer);
});
}
Fantastic!
The problem with changing things in the Themes folder, is that it is imported into the component that creates the store (Root.js). This is mentioned here:
https://github.com/reactjs/react-redux/issues/347
I played around with it a little, and changed Root.js to be:
import React from 'react'
import configureStore from './Store/Store'
import App from './App'
const store = configureStore()
export default class RNBase extends React.Component {
render () {
return <App {...this.props} store={store} />
}
};
Then, App.js is the old Root.js, minus the configureStore
call. I am not set up to test on Android right now, so I didn't try to make a PR.
@phoenecke - that's the best solution yet! I tested it on iOS and Android with perfect success! I changed the style just a little, but we're good! Thanks so much! This will be in master soon.
I'll be sure to give you credit in the release docs
I can still reproduce the bug, shouldn't it be fixed? Ignite 1.8.0
depends, what are you editing? The app.js? or the styles?
The app.js hot reloading will eventually be fixed by @skellock - He knows why it doesn't work. Though if you know the solution, feel free to PR :)
Are you editing a saga or reducer? If so, then it's still an issue because we haven't hotloaded redux just yet.
This fix was for visual things: basically everything in themes.
Here's an example of the way out:
https://github.com/erikras/react-redux-universal-hot-example/blob/master/src/redux/create.js#L28-L32
And
I really want to do this fix, but there's a thousand things on my plate and I'm failing at all them. Haha.
I see, I guessed it has been already fixed (because of Closed status), sorry :)
@phoenecke nice solution!
I keep having this issue with new Apps when I try to update reducers/sagas.
I've made a PR for that -> https://github.com/infinitered/ignite-ir-boilerplate/pull/143
@skellock I guess you are under heavy loading so I made it for you <3
Smart components have a provider error in some situations. @skellock says this is because of how we're replacing the reducers, instead of properly adding them in this situation.