Components not re-rendering/mapStateToProps not firing in electron-webpack/electron-builder production build
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What is the current behavior?
In the production build of my electron application, changes made in the redux store are not being picked up by connect()
ed react components. This issue only appears in the production built app, however, and there is no issue with the development build.
Here is a minimal repo that showcases the issue: https://github.com/TrentWest7190/react-redux-electron-production-issue
What is the expected behavior?
The production built app functions properly.
Which versions of React, ReactDOM/React Native, Redux, and React Redux are you using? Which browser and OS are affected by this issue? Did this work in previous versions of React Redux?
react-redux: 6.0.1 React/ReactDOM: 16.8.6 redux: 4.0.1
I am on, and building for, windows. I’m unsure if previous versions of react-redux had this issue or not, this is my first time using it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
In looking at the electron-webpack issues on github, I found this issue that gave a possible fix for this. https://github.com/electron-userland/electron-webpack/issues/275
Turns out, for whatever reason, this fixes both the original issue I posted, as well as the strange hook issue, so no matter what weird incompatibility is going on here, it’s 100% not react-redux’s fault. Sorry!
If anybody is looking for a quick fix to this oddly specific problem, the solution is to drop this in your package.json:
"electronWebpack": { "whiteListedModules": [ "react-redux" ] }
Honestly don’t care to find out why this fixes it, I’m just happy to finally get this to work. 🤷♂️
Interestingly enough, v7 doesn’t seem to function at all in this environment, even in development.
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
Which is an interesting issue because there aren’t any react hooks in my code…