Merge pull request woocommerce/woocommerce-admin#1732 from woocommerce/fix/1565-disable-data-fetch-inactive-tabs

Skip dispatching fresh data requests when the window/tab is hidden.
This commit is contained in:
Jeff Stieler 2019-03-04 15:16:19 -07:00 committed by GitHub
commit d7218a759b
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,9 @@ function createStore( name ) {
function createDataHandlers( store ) {
return {
dataRequested: resourceNames => {
if ( document.hidden ) {
return;
}
store.dispatch( {
type: 'FRESH_DATA_REQUESTED',
resourceNames,