Skip to content

Whole app is being updated each time a redux state is changed, bug with 3.2.3 #111

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

Closed
Ethorsen opened this issue Jul 18, 2018 · 5 comments
Closed
Assignees
Labels

Comments

@Ethorsen
Copy link

Ethorsen commented Jul 18, 2018

Do you want to request a feature or report a bug?

Bug since v3.2.3 when using with redux

What is the current behavior?

The whole app is re-rendering whenever a redux state changes. That behavior is not present in 3.2.2

JSFiddle with 3.2.3 illustrating the problem.
https://jsfiddle.net/g3sb14n9/

JSFiddle with 3.2.2 and exact same code, without the problem
https://jsfiddle.net/erah1nqv/

If you open the console, you will see when each component is triggered an update.

What is the expected behavior?

Only connected components update.

Which versions of react and react-localize-redux are you using?

Using
"react": "16.4.1",
"react-localize-redux": "3.2.3", (working with 3.2.2)
"react-redux": "5.0.7",
"redux": "4.0.0" (same with 3.7.2)

I blocked react-localize-redux to 3.2.2 until this can be figured out.

@Ethorsen Ethorsen changed the title Whole app is being updated each time a redux state is changed Whole app is being updated each time a redux state is changed, bug with 3.2.3 Jul 18, 2018
@kenhuang
Copy link

Confirm serious performance issue in 3.2.3, we have to fix our app like this:

-    "react-localize-redux": "^3.2.0",
+    "react-localize-redux": "3.2.2",

@ryandrewjohnson
Copy link
Owner

Thanks for catching this .. I will look at this today.

@ryandrewjohnson
Copy link
Owner

ryandrewjohnson commented Jul 19, 2018

@Ethorsen @kenhuang thanks again for catching this and providing those great examples. I've just published a fix that should take care of the issue. @Ethorsen when updating your original JS fiddle with 3.2.4 it looks good now, but if you could just confirm on your end that would be great.

For those interested the culprit was from a change here that was made to the getOptions selector. A new copy of the state was being made each time, which would always invalidate the selectors hence resulting in a re-render.

@Ethorsen
Copy link
Author

So far so good

@ryandrewjohnson
Copy link
Owner

Going to consider this one fixed. Please reopen if issues persist.

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

3 participants