Wait until all chart data page requests are complete before rendering.
This commit is contained in:
parent
edbbc33701
commit
6cb15280bb
|
@ -274,6 +274,7 @@ export function getReportChartData( options ) {
|
|||
let isError = false;
|
||||
const pagedData = [];
|
||||
const totalPages = Math.ceil( stats.totalResults / MAX_PER_PAGE );
|
||||
let pagesFetched = 1;
|
||||
|
||||
for ( let i = 2; i <= totalPages; i++ ) {
|
||||
const nextQuery = { ...requestQuery, page: i };
|
||||
|
@ -288,7 +289,9 @@ export function getReportChartData( options ) {
|
|||
}
|
||||
|
||||
pagedData.push( _data );
|
||||
if ( i === totalPages ) {
|
||||
pagesFetched++;
|
||||
|
||||
if ( pagesFetched === totalPages ) {
|
||||
isFetching = false;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue