Skip to content

Commit

Permalink
fix: ensure grid root cache has a valid size (#8525) (#8526)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
  • Loading branch information
vaadin-bot and tomivirkki authored Jan 17, 2025
1 parent 3de0ef2 commit d4c59c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/grid/src/vaadin-grid-data-provider-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export const DataProviderMixin = (superClass) =>
*/
clearCache() {
this._dataProviderController.clearCache();
this._dataProviderController.rootCache.size = this.size;
this._dataProviderController.rootCache.size = this.size || 0;
this._dataProviderController.recalculateFlatSize();
this._hasData = false;
this.__updateVisibleRows();
Expand Down
7 changes: 7 additions & 0 deletions packages/grid/test/data-provider.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,13 @@ describe('data provider', () => {
}
});

it('should not jam on clear cache', () => {
grid.dataProvider = (params, callback) => {
setTimeout(() => finiteDataProvider(params, callback), 0);
};
grid.clearCache();
});

it('should not render synchronously until all data requests have finished', (done) => {
generateItemIds = true;
grid.itemIdPath = 'id';
Expand Down

0 comments on commit d4c59c9

Please sign in to comment.