Return immediately if no alerts found
This commit is contained in:
parent
416d41279f
commit
f8e97b8152
|
@ -61,6 +61,11 @@ class StoreAlerts extends Component {
|
|||
|
||||
render() {
|
||||
const { alerts } = this.props;
|
||||
|
||||
if ( ! alerts || alerts.length === 0 ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { currentIndex } = this.state;
|
||||
const numberOfAlerts = alerts.length;
|
||||
const alert = alerts[ currentIndex ] ? alerts[ currentIndex ] : null;
|
||||
|
@ -78,7 +83,6 @@ class StoreAlerts extends Component {
|
|||
) );
|
||||
|
||||
return (
|
||||
numberOfAlerts > 0 && (
|
||||
<Card
|
||||
title={ [
|
||||
alert.icon && <Dashicon key="icon" icon={ alert.icon } />,
|
||||
|
@ -123,7 +127,6 @@ class StoreAlerts extends Component {
|
|||
/>
|
||||
{ actions && <div className="woocommerce-store-alerts__actions">{ actions }</div> }
|
||||
</Card>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue