@lavalogic/scoria 0.11.4 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -847,26 +847,35 @@ export class TableContext {
|
|
|
847
847
|
? Math.min(this.paginationRepo.pageEndIndexExclusive, this.sortedData.length)
|
|
848
848
|
: this.sortedData.length;
|
|
849
849
|
const selectableMethod = this.columnDefs.find((it) => it instanceof RowSelectionDef)?.isSelectable;
|
|
850
|
+
const updateSelectedItem = (item) => {
|
|
851
|
+
const key = this.selectionExtractor(item);
|
|
852
|
+
if (this.selectedItems.has(key)) {
|
|
853
|
+
//replace selected item with newer version of the same identity
|
|
854
|
+
this.selectedItems.set(key, item);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
850
857
|
if (selectableMethod) {
|
|
851
858
|
for (let index = pageStartIndex; index < pageEndIndexExclusive; index++) {
|
|
852
859
|
const item = this.sortedData[index];
|
|
860
|
+
// HACK: Please find why this is happening and fix it properly
|
|
861
|
+
if (!item) {
|
|
862
|
+
console.warn(`skipping update because there is a data mismatch, page start index: ${pageStartIndex}, current index ${index}, page end index (exlusive) ${pageEndIndexExclusive}`, $state.snapshot(this.sortedData));
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
853
865
|
if (await selectableMethod(item, index)) {
|
|
854
|
-
|
|
855
|
-
if (this.selectedItems.has(key)) {
|
|
856
|
-
//replace selected item with newer version of the same identity
|
|
857
|
-
this.selectedItems.set(key, item);
|
|
858
|
-
}
|
|
866
|
+
updateSelectedItem(item);
|
|
859
867
|
}
|
|
860
868
|
}
|
|
861
869
|
}
|
|
862
870
|
else {
|
|
863
871
|
for (let index = pageStartIndex; index < pageEndIndexExclusive; index++) {
|
|
864
872
|
const item = this.sortedData[index];
|
|
865
|
-
|
|
866
|
-
if (
|
|
867
|
-
|
|
868
|
-
|
|
873
|
+
// HACK: Please find why this is happening and fix it properly
|
|
874
|
+
if (!item) {
|
|
875
|
+
console.warn(`skipping update because there is a data mismatch, page start index: ${pageStartIndex}, current index ${index}, page end index (exlusive) ${pageEndIndexExclusive}`, $state.snapshot(this.sortedData));
|
|
876
|
+
return;
|
|
869
877
|
}
|
|
878
|
+
updateSelectedItem(item);
|
|
870
879
|
}
|
|
871
880
|
}
|
|
872
881
|
this.recalculateAllSelectedInCurrentPage();
|