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

[Base] - Fix hot reloading #155

Closed
GantMan opened this issue Jun 8, 2016 · 16 comments
Closed

[Base] - Fix hot reloading #155

GantMan opened this issue Jun 8, 2016 · 16 comments
Assignees
Milestone

Comments

@GantMan
Copy link
Member

GantMan commented Jun 8, 2016

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.

simulator screen shot jun 8 2016 12 48 43 pm

@GantMan GantMan added the bug label Jun 8, 2016
@GantMan GantMan added this to the 1.1 milestone Jun 8, 2016
@bradennapier
Copy link

+1 - running into this , hot reloading doesnt seem to work -- just tried to update the drawer

@GantMan
Copy link
Member Author

GantMan commented Jun 11, 2016

if you update a component, it works. Any container it doesn't.

@GantMan
Copy link
Member Author

GantMan commented Jun 11, 2016

We can fix this, though.

@bradennapier
Copy link

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);
    });
  }

@skellock
Copy link
Contributor

Fantastic!

@phoenecke
Copy link

phoenecke commented Jun 25, 2016

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:

reduxjs/react-redux#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.

hot

@GantMan
Copy link
Member Author

GantMan commented Jun 25, 2016

@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

@GantMan
Copy link
Member Author

GantMan commented Jun 25, 2016

#197

@GantMan GantMan closed this as completed Jun 25, 2016
@cinan
Copy link

cinan commented Sep 27, 2016

I can still reproduce the bug, shouldn't it be fixed? Ignite 1.8.0

@GantMan
Copy link
Member Author

GantMan commented Sep 27, 2016

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 :)

@skellock
Copy link
Contributor

Are you editing a saga or reducer? If so, then it's still an issue because we haven't hotloaded redux just yet.

@skellock
Copy link
Contributor

This fix was for visual things: basically everything in themes.

@skellock
Copy link
Contributor

skellock commented Sep 27, 2016

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

http://stackoverflow.com/questions/34243684/make-redux-reducers-and-other-non-components-hot-loadable

I really want to do this fix, but there's a thousand things on my plate and I'm failing at all them. Haha.

@cinan
Copy link

cinan commented Sep 28, 2016

I see, I guessed it has been already fixed (because of Closed status), sorry :)

@handycode
Copy link

@phoenecke nice solution!

@Fr33maan
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants