Coding Standards: Fix getReportItems function call order (https://github.com/woocommerce/woocommerce-admin/pull/3724)

This commit is contained in:
Paul Sealock 2020-02-17 14:02:32 +13:00 committed by GitHub
parent ae11c1a0de
commit 43274b9fa8
1 changed files with 5 additions and 1 deletions

View File

@ -451,12 +451,16 @@ export function getReportTableData( options ) {
},
};
// Disable eslint rule requiring `items` to be defined below because the next two if statements
// depend on `getReportItems` to have been called.
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
const items = getReportItems( endpoint, tableQuery );
if ( isReportItemsRequesting( endpoint, tableQuery ) ) {
return { ...response, isRequesting: true };
} else if ( getReportItemsError( endpoint, tableQuery ) ) {
return { ...response, isError: true };
}
const items = getReportItems( endpoint, tableQuery );
return { ...response, items };
}