-
Notifications
You must be signed in to change notification settings - Fork 667
Rerender only when data for given reduxes has changed #2564
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
Rerender only when data for given reduxes has changed #2564
Conversation
d778270 to
f022c66
Compare
f022c66 to
01140c8
Compare
|
/cc @christianvogt |
| }); | ||
|
|
||
| const propsAreEqual = (prevProps, nextProps) => { | ||
| if (nextProps.children === prevProps.children && nextProps.reduxes === prevProps.reduxes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several other props missing from this check: filters, loaded, loadError, resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how so ? ConnectToState has only 3 props - children, reduxes (both from Firehose) and k8s (from mapStateToProps). Am I wrong ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry you're right. Not sure how I came to that conclusion before.
|
@rawagner i haven't tried locally but it would seem that if |
|
I'd suggest we push this to 4.3 to give it more soak time. |
not necessarily, I've tried with and without this change on Dashboards Page where a lot of resources are fetched via various cards (all pods, all events etc..) and it reduced the amount of rerenders |
|
Tried out the changes. While sitting on the dashboard page it almost looks like the same cards are being updated but visually nothing has changed as before applying the fix. Seems to me this is an improvement but still more work could be done. Do you mind posting a specific scenario where you compare the before and after? |
|
@christianvogt thanks for trying it out! The easiest scenario would probably be
|
Im not sure how to optimize |
|
Tried out the fix with the above mentioned PR and it was an improvement. I didn't see any side effects. |
|
/approve |
|
@spadgett what would you like to do? |
spadgett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is a small change and easy to rollback if needed, let’s go ahead. We have a little bit of soak time.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, rawagner, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
ConnectToStateupdates children everytimek8smap is changed, which means that even if watched resource isn't changed, but something else ink8smap changed, we unnecessarily rerender child component. For example, we have two components -AandB.Ais watching all pods,Bis watching all nodes. Pods are updated,k8smap is changed andAandBare rerendered. butBdoesnt have to be.To optimize rerenders we can check only parts of
k8smap and rerender only when the parts we are interested in have changed.Or maybe I misread something :)
@spadgett