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

example 02-redux cause error message when updating reducer #64

Closed
oriSomething opened this issue Oct 7, 2015 · 19 comments
Closed

example 02-redux cause error message when updating reducer #64

oriSomething opened this issue Oct 7, 2015 · 19 comments
Labels

Comments

@oriSomething
Copy link

<Provider> does not support changing `store` on the fly.
It is most likely that you see this error because you updated
to Redux 2.x and React Redux 2.x which no longer hot
reload reducers automatically.
See https://github.com/rackt/react-redux/releases/tag/v2.0.0
for the migration instructions.
@milankinen
Copy link
Owner

This is an issue/feature in redux. As you can see, the warning doesn't affect live reloading.

@milankinen
Copy link
Owner

Version 2.0.4 introduces a way to accept the reloaded module, thus preventing this error.

Please see https://github.com/milankinen/livereactload/blob/master/examples/02-redux/store/configureStore.js

@c089
Copy link

c089 commented Feb 4, 2016

@milankinen: I'm still seeing this warning with 2.1.1 despite the return true in my onReload fn:

export default function configureStore(initialState) {
  const devTools = window.devToolsExtension ? window.devToolsExtension() : undefined;
  const store = createStore(reducer, initialState, devTools);

  if (module.onReload) {
    module.onReload(() => {
      store.replaceReducer(require('./reducers').default);
      return true;
    });
  }

  return store;
}

@milankinen milankinen reopened this Feb 4, 2016
@c089
Copy link

c089 commented Feb 4, 2016

Hm, running the example from the repo I don't get the error. I wonder if there's anything besides configureStore I could have misconfigured... Even when I use configureStore exactly like in the example, I do get the warning in my project.

@milankinen
Copy link
Owner

@c089, is your repo (having this problem) public so that I can check it out myself?

@c089
Copy link

c089 commented Feb 5, 2016

Unfortunately not as it's a client project. But I'll try to reproduce this with a new, minimal setup. The only thing I can think of right now is that it uses newer versions of the libraries than the 02 example...

@milankinen
Copy link
Owner

@c089 what Redux version you're using in your client project at the moment (could you check the actual version from your node_modules/redux/package.json)?

@c089
Copy link

c089 commented Feb 5, 2016

❯ npm ls | ag redux
├─┬ react-redux@4.2.1
├─┬ redux@3.2.1

@milankinen
Copy link
Owner

Hmmm strange... Tested with newer versions and got no problems:

02-redux (development *) $ npm i
npm WARN package.json livereactload-flux-with-redux-example@2.0.0 No repository field.
redux@3.2.1 node_modules/redux
├── loose-envify@1.1.0 (js-tokens@1.0.2)
└── lodash@4.2.1

react-redux@4.3.0 node_modules/react-redux
├── invariant@2.2.0
├── hoist-non-react-statics@1.0.5
├── loose-envify@1.1.0 (js-tokens@1.0.2)
└── lodash@4.2.1

@DjebbZ
Copy link
Contributor

DjebbZ commented Feb 9, 2016

Same problem here. The only difference in the hot-reloading code is that I don't use .default after requiring my reducer. I think it's because even if I use Babel 6, my module doesn't have a default export but several ones, and also that I use commonJS and not ES2015.

Versions used (npm ls | grep redux) :

├─┬ react-redux@4.1.2
├── redux@3.0.6
├── redux-logger@2.4.0
├── redux-thunk@1.0.3

@milankinen
Copy link
Owner

Thanks! I'll test it with those versions.

Is it possible to identify which files with modifications cause the warning? reducers.js (or its dependencies)? Or perhaps some other files?

@DjebbZ
Copy link
Contributor

DjebbZ commented Feb 9, 2016

The warning came from my reducer file. Editing everything else -- actions, app entry point, React components, other redux stuff like mapStateToProps() -- worked perfectly.

@sleepylemur
Copy link

Getting this warning from a fresh clone of the example 02-redux. Fixed it once by doing npm link and fiddling with versions of react-proxy, but am unable to duplicate the fix... I obviously have no idea what I'm doing :) Works well despite the warning though. (warning pops up when editing Counter.js)

@sassanh
Copy link

sassanh commented Jul 6, 2016

I get the error in a fresh clone of the repository in 02-redux example too. Editing counter.js generates the warning.

@milankinen
Copy link
Owner

Going to take a look at this during this week! Probably linked with #111 somehow.

@sassanh
Copy link

sassanh commented Jul 10, 2016

@milankinen could you please give me some instructions how should I use livereactload to have hot module loading with react, redux and router? I really prefer browserify environment but if I can't have hot module loading for my project I'll be forced to use webpack. I guess I can manage it to work if you manage to make example 02-redux work though it'd be much more helpful if you could add router to it too.

@sassanh
Copy link

sassanh commented Jul 12, 2016

@milankinen ok I was able to use livereactload with redux and route.
I described my problem with route in detail here: #43 (comment)

My problem with redux was that I wasn't using react-proxy@1.x nor babel-plugin-react-transform so my components were not wrapped in proxies.
It'd be much easier to find the issue if livereactload raised an explicit error when user is not applying the required transform. The weird thing is livereactload was working without livereactload/babel-transform if I didn't use redux or route.

@milankinen
Copy link
Owner

@sassanh Very good idea! It would be easy to implement as well. Creating another issue for that.

I'll keep this issue open because there is a bug in the current 2.2.4 release (see #43 (comment)).

@milankinen milankinen added bug and removed question labels Jul 13, 2016
@milankinen
Copy link
Owner

This should be fixed a long time ago. Closing this one and reopen if any issues still exist.

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

No branches or pull requests

6 participants