Make sure notices element exist before creating <WordPressNotices> (https://github.com/woocommerce/woocommerce-admin/pull/2378)

This commit is contained in:
Albert Juhé Lluveras 2019-06-11 14:14:06 +02:00 committed by GitHub
parent 8ed63c5547
commit 8790655c39
1 changed files with 7 additions and 5 deletions

View File

@ -254,11 +254,13 @@ class ActivityPanel extends Component {
className="woocommerce-layout__activity-panel-tabs"
>
{ tabs && tabs.map( this.renderTab ) }
<WordPressNotices
showNotices={ 'wpnotices' === currentTab }
togglePanel={ this.togglePanel }
onCountUpdate={ this.updateNoticeFlag }
/>
{ Boolean( document.getElementById( 'wp__notice-list' ) ) && (
<WordPressNotices
showNotices={ 'wpnotices' === currentTab }
togglePanel={ this.togglePanel }
onCountUpdate={ this.updateNoticeFlag }
/>
) }
</NavigableMenu>
{ this.renderPanel() }
</div>