Stop API requests when we know no alerts exist

This commit is contained in:
Tiago Noronha 2019-03-06 23:04:13 +00:00
parent dd8d1fbb8b
commit 0cdaf1bee2
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,12 @@ class StoreAlerts extends Component {
export default compose(
withSelect( select => {
const { alertCount } = wcSettings;
if ( ! alertCount || 0 === alertCount ) {
return { alerts: null };
}
const { getNotes } = select( 'wc-api' );
const alertsQuery = {
page: 1,