React-hot-loader: react-redux 5.0.2 to 5.0.3 update break hot reloading

Created on 28 Feb 2017  路  5Comments  路  Source: gaearon/react-hot-loader

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.

Most helpful comment

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:

[email protected], react-redux 5.0.3

  • Hot reloading works as expected

[email protected], 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)

[email protected], 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)

[email protected], react-redux 5.0.2

  • HMR works just fine

I tried to debug the issue but only change I can think of is https://github.com/gaearon/react-hot-loader/issues/396 馃

All 5 comments

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.

@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.

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:

[email protected], react-redux 5.0.3

  • Hot reloading works as expected

[email protected], 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)

[email protected], 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)

[email protected], react-redux 5.0.2

  • HMR works just fine

I tried to debug the issue but only change I can think of is https://github.com/gaearon/react-hot-loader/issues/396 馃

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

niba picture niba  路  4Comments

theKashey picture theKashey  路  3Comments

sandysaders picture sandysaders  路  4Comments

mtscout6 picture mtscout6  路  3Comments

mattkrick picture mattkrick  路  3Comments