Only render NotificationBadge when needed (#9493)

This commit is contained in:
Germain 2022-10-25 14:31:38 +01:00 committed by GitHub
parent 6e73a853a8
commit 249474b430
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -111,7 +111,12 @@ export default class NotificationBadge extends React.PureComponent<XOR<IProps, I
public render(): React.ReactElement {
/* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */
const { notification, showUnsentTooltip, onClick } = this.props;
const { notification, showUnsentTooltip, forceCount, onClick } = this.props;
if (notification.isIdle) return null;
if (forceCount) {
if (!notification.hasUnreadCount) return null; // Can't render a badge
}
let label: string;
let tooltip: JSX.Element;