perspective load fix

This commit is contained in:
Jan Prochazka
2022-08-06 11:37:44 +02:00
parent 9a2c12d558
commit ae6c486db5

View File

@@ -70,20 +70,25 @@ export class PerspectiveDataProvider {
// console.log('CACHE', tableCache.bindingGroups); // console.log('CACHE', tableCache.bindingGroups);
let groupIndex = 0; let groupIndex = 0;
let loadCalled = false;
let shouldReturn = false;
for (; groupIndex < props.bindingValues.length; groupIndex++) { for (; groupIndex < props.bindingValues.length; groupIndex++) {
const groupValues = props.bindingValues[groupIndex]; const groupValues = props.bindingValues[groupIndex];
const group = tableCache.getBindingGroup(groupValues); const group = tableCache.getBindingGroup(groupValues);
let loadCalled = false;
if (!group.loadedAll) { if (!group.loadedAll) {
// wee need to load next data if (loadCalled) {
await this.loadNextGroup(props, groupIndex); shouldReturn = true;
loadCalled = true; } else {
// we need to load next data
await this.loadNextGroup(props, groupIndex);
loadCalled = true;
}
} }
// console.log('GRP', groupValues, group); // console.log('GRP', groupValues, group);
rows.push(...group.loadedRows); rows.push(...group.loadedRows);
if (rows.length >= props.topCount || loadCalled) { if (rows.length >= props.topCount || shouldReturn) {
return { return {
rows: rows.slice(0, props.topCount), rows: rows.slice(0, props.topCount),
incomplete: props.topCount < rows.length || !group.loadedAll || groupIndex < props.bindingValues.length - 1, incomplete: props.topCount < rows.length || !group.loadedAll || groupIndex < props.bindingValues.length - 1,