Skip to content

Commit

Permalink
try fixing reset instead
Browse files Browse the repository at this point in the history
  • Loading branch information
sissbruecker committed Feb 26, 2025
1 parent 6da2d5d commit dafda5b
Showing 1 changed file with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,27 +542,6 @@ window.Vaadin.Flow.gridConnector.initLazy = (grid) => {
}
};

/**
* Update the given page of items in the DOM, if the items are visible
*/
const updatePageInDom = function (pageItems) {
const firstItem = pageItems[0];
if (!firstItem) {
return;
}

// Item might not be in grid cache yet if there is a pending request for that page
const firstItemContext = dataProviderController.getItemContext(firstItem);
if (!firstItemContext) {
return;
}

// Update the visible rows in the grid
const flatStartIndex = firstItemContext.flatIndex;
const flatEndIndex = flatStartIndex + pageItems.length - 1;
grid.__updateVisibleRows(flatStartIndex, flatEndIndex);
};

grid.$connector.set = function (index, items, parentKey) {
if (index % grid.pageSize != 0) {
throw 'Got new data to index ' + index + ' which is not aligned with the page size of ' + grid.pageSize;
Expand All @@ -588,9 +567,11 @@ window.Vaadin.Flow.gridConnector.initLazy = (grid) => {
grid.$connector.doSelection(slice.filter((item) => item.selected));
grid.$connector.doDeselection(slice.filter((item) => !item.selected && selectedKeys[item.key]));

updateGridCache(page, pkey);
itemsUpdated(slice);
updatePageInDom(slice);
const updatedItems = updateGridCache(page, pkey);
if (updatedItems) {
itemsUpdated(updatedItems);
updateGridItemsInDomBasedOnCache(updatedItems);
}
}
};

Expand Down Expand Up @@ -752,7 +733,6 @@ window.Vaadin.Flow.gridConnector.initLazy = (grid) => {
};

grid.$connector.reset = function () {
grid.size = 0;
cache = {};
dataProviderController.rootCache.items = [];
lastRequestedRanges = {};
Expand Down

0 comments on commit dafda5b

Please sign in to comment.