Merge pull request woocommerce/woocommerce-admin#980 from woocommerce/fix/911-first-request-is-requesting
Order data: fix `isGetOrdersRequesting()` for the first request.
This commit is contained in:
commit
0c76f550a5
|
@ -1,4 +1,10 @@
|
|||
/** @format */
|
||||
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { isNil } from 'lodash';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
@ -26,7 +32,16 @@ const getOrdersTotalCount = ( getResource, requireResource ) => (
|
|||
const isGetOrdersRequesting = getResource => ( query = {} ) => {
|
||||
const resourceName = getResourceName( 'order-query', query );
|
||||
const { lastRequested, lastReceived } = getResource( resourceName );
|
||||
return lastRequested && lastRequested > lastReceived;
|
||||
|
||||
if ( isNil( lastRequested ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isNil( lastReceived ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return lastRequested > lastReceived;
|
||||
};
|
||||
|
||||
const isGetOrdersError = getResource => ( query = {} ) => {
|
||||
|
|
Loading…
Reference in New Issue