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

react-redux 5.0.2 to 5.0.3 update break hot reloading #492

Closed
BerndWessels opened this issue Feb 28, 2017 · 5 comments
Closed

react-redux 5.0.2 to 5.0.3 update break hot reloading #492

BerndWessels opened this issue Feb 28, 2017 · 5 comments

Comments

@BerndWessels
Copy link

BerndWessels commented Feb 28, 2017

Description

After updating from react-redux 5.0.2 to 5.0.3 hot reloading break the redux state.

Expected behavior

hot reloading should not break redux state.

Actual behavior

with react-redux 5.0.3 the redux state breaks after a hot reload has happened.

Environment

react-hot-loader 3.0.0-beta.6

Reproducible Demo

Any project will do, just upgrade react-redux to 5.0.3 and experience the issue.

@BerndWessels BerndWessels changed the title redux 5.0.2 to 5.0.3 update break hot reloading react-redux 5.0.2 to 5.0.3 update break hot reloading Feb 28, 2017
@calesce
Copy link
Collaborator

calesce commented Feb 28, 2017

Can you confirm whether this breaks when you don't have React Hot Loader? From your description it sounds like it just breaks HMR for Redux state, not React components specifically.

@BerndWessels
Copy link
Author

@calesce For me it looks like the store becomes disconnected somehow - components don't break - actually after some more digging in 5.0.2 there is a weird effect that after the 1st hmr the state is still fine but after the 2nd hmr and then ongoing it becomes like a toggle where only every other state change is reflected by connected components. in 5.0.3 its completely broken/the components seem to be connected to a state that is not modified by actions anymore - or actions do not modify the state that is connected to the components.

There is a very simple demo repo you can find here.

I also noticed that hmr with react-hot-loader 3.0.0-beta.6 became a bit flaky/unreliable. So sometimes hmr just doesn't work until a full page reload and such things. But that might not be related to the react-redux problem which can reliably be reproduced.

@petetnt
Copy link

petetnt commented Mar 8, 2017

Edit: Disregard most of this, it seems to have come back with beta.5 too

Not sure if it's related, but I think the issue is not with react-redux but with react-hot-loader: tried with different options and the following happens:

react-hot-loader@3.0.0-beta.5, react-redux 5.0.3

  • Hot reloading works as expected

react-hot-loader@3.0.0-beta.6, react-redux 5.0.3

  • Loading the page fails with
Uncaught TypeError: Cannot read property 'shape' of undefined
    at eval (eval at ./node_modules/react-redux/es/utils/PropTypes.js (main.js:5650), <anonymous>:7:73)
    at Object../node_modules/react-redux/es/utils/PropTypes.js (main.js:5650)
    at __webpack_require__ (main.js:660)
    at fn (main.js:84)
    at Object.eval (eval at ./node_modules/react-redux/es/components/Provider.js (main.js:5570), <anonymous>:3:75)
    at eval (eval at ./node_modules/react-redux/es/components/Provider.js (main.js:5570), <anonymous>:73:30)
    at Object../node_modules/react-redux/es/components/Provider.js (main.js:5570)
    at __webpack_require__ (main.js:660)
    at fn (main.js:84)
    at eval (eval at ./node_modules/react-redux/es/index.js (main.js:5642), <anonymous>:1:79)

react-hot-loader@3.0.0-beta.6, react-redux 5.0.2

  • Loading the page fails with:
Uncaught TypeError: Cannot read property 'shape' of undefined
    at eval (eval at ./node_modules/react-redux/es/utils/storeShape.js (main.js:5666), <anonymous>:5:105)
    at Object../node_modules/react-redux/es/utils/storeShape.js (main.js:5666)
    at __webpack_require__ (main.js:660)
    at fn (main.js:84)
    at Object.eval (eval at ./node_modules/react-redux/es/components/Provider.js (main.js:5570), <anonymous>:4:76)
    at eval (eval at ./node_modules/react-redux/es/components/Provider.js (main.js:5570), <anonymous>:75:30)
    at Object../node_modules/react-redux/es/components/Provider.js (main.js:5570)
    at __webpack_require__ (main.js:660)
    at fn (main.js:84)
    at eval (eval at ./node_modules/react-redux/es/index.js (main.js:5642), <anonymous>:1:79)

react-hot-loader@3.0.0-beta.5, react-redux 5.0.2

  • HMR works just fine

I tried to debug the issue but only change I can think of is #396 🤔

@pisrael
Copy link

pisrael commented Jul 18, 2017

For me, the problem was with react-redux. I was using version 5.05 of react-redux, went back to version 4.4.8 and it solved the issue. I'm not using react-hot-loader.

The project uses typescript. The @types/react-redux version refers to version 4, no idea if that could be affecting the compilation by somehow providing wrong types of the lib, as going back to version 4 solved the issue I did not try to remove @types/react-redux to test this hypothesis.

@gregberge
Copy link
Collaborator

gregberge commented Oct 15, 2017

Seems fixed reduxjs/react-redux#715

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

6 participants