Skip to content
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

Bug 1795707: improve notification drawer performance #4192

Merged

Conversation

spadgett
Copy link
Member

@spadgett spadgett commented Feb 4, 2020

  • Don't lazy-load component since it will always load. This prevents the black box over the entire page during load
  • Fix problem where useEffect hook constantly fires
  • Don't return a new object each call to notificationStateToProps when alerts are empty
  • Fix incorrect FirehoseResult type

/assign @jcaianirh @benjaminapetersen

@openshift-ci-robot
Copy link
Contributor

@spadgett: This pull request references Bugzilla bug 1795707, which is valid. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Bug 1795707: improve notification drawer performance

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 4, 2020
@spadgett
Copy link
Member Author

spadgett commented Feb 4, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2020
@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 4, 2020
};
};

const notificationStateToProps = ({ UI }: RootState): WithNotificationsProps => ({
isDrawerExpanded: !!UI.getIn(['notifications', 'isExpanded']),
notificationsRead: !!UI.getIn(['notifications', 'isRead']),
alerts: UI.getIn(['monitoring', 'notificationAlerts']) || {},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a different empty object each time caused unnecessary renders.

}
}, [criticalAlertList, isAlertExpanded, isDrawerExpanded, prevDrawerToggleState]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

criticalAlertList was different every render, so this always fired

@@ -14,11 +14,12 @@ if [ -d "$ARTIFACT_DIR" ]; then
cp public/dist/report.html "${ARTIFACT_DIR}"
fi

MAX_BYTES=2621440 # ~2.5 MiB
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't do floating point calculations in bash (2.5 * 1024 * 1024), so I just hard-coded the value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett i ran into this too...was wondering how you wanted this to be modified...

* Don't lazy-load component since it will always load
* Fix problem where `useEffect` hook constantly fires
* Don't return a new object each call to `notificationStateToProps`
* Fix incorrect FirehoseResult type
@spadgett
Copy link
Member Author

spadgett commented Feb 7, 2020

Rebased, @jcaianirh @benjaminapetersen another look?

@spadgett
Copy link
Member Author

spadgett commented Feb 7, 2020

/retest

Copy link
Member

@jcaianirh jcaianirh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcaianirh, spadgett

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@spadgett spadgett added the lgtm Indicates that a PR is ready to be merged. label Feb 7, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

6 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit a0601bb into openshift:master Feb 8, 2020
@spadgett spadgett deleted the notification-drawer-loading branch February 8, 2020 13:35
@spadgett spadgett added this to the v4.4 milestone Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants