Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Components not re-rendering/mapStateToProps not firing in electron-webpack/electron-builder production build

See original GitHub issue

Do you want to request a feature or report a 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:

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:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

TrentWest7190commented, Apr 11, 2019

In looking at the electron-webpack issues on github, I found this issue that gave a possible fix for this.

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. 🤷‍♂️

TrentWest7190commented, Apr 11, 2019

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why isn't my component re-rendering or my mapstatetoprops ...
But when I map my redux state to the props, it is not working. My redux-dev-tools is giving me a full state. If...
Read more >
Connect | React Redux
If your mapStateToProps function is declared as taking two parameters, it will be called whenever the store state changes or when the wrapper ......
Read more >
How to stop re-rendering lists in React? - Alex Sidorenko
There is a common misconception that a React component will not re-render unless one of its properties changes. This is not true:.
Read more >
Connect: Extracting Data with mapStateToProps | React Redux
This function should be passed as the first argument to connect , and will be called every time when the Redux store state...
Read more >
Component state: local state, Redux store, and loaders
In a component built with ES6 classes, whenever the state changes (only ... Something that is not possible with the usage of local...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found