diff --git a/packages/grid/src/vaadin-grid-data-provider-mixin.js b/packages/grid/src/vaadin-grid-data-provider-mixin.js index 3104a43c85..4cb6f0bbef 100644 --- a/packages/grid/src/vaadin-grid-data-provider-mixin.js +++ b/packages/grid/src/vaadin-grid-data-provider-mixin.js @@ -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(); diff --git a/packages/grid/test/data-provider.common.js b/packages/grid/test/data-provider.common.js index 27ed80719e..2241c56304 100644 --- a/packages/grid/test/data-provider.common.js +++ b/packages/grid/test/data-provider.common.js @@ -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';