diff --git a/src/vaadin-grid-data-provider-mixin.html b/src/vaadin-grid-data-provider-mixin.html index a6104f788..53719a718 100644 --- a/src/vaadin-grid-data-provider-mixin.html +++ b/src/vaadin-grid-data-provider-mixin.html @@ -201,6 +201,8 @@ this._cache.size += delta; this._cache.effectiveSize += delta; this._effectiveSize = this._cache.effectiveSize; + this._increasePoolIfNeeded(0); + this._debounceIncreasePool && this._debounceIncreasePool.flush(); } /** diff --git a/test/physical-count.html b/test/physical-count.html index 090977c99..99da18928 100644 --- a/test/physical-count.html +++ b/test/physical-count.html @@ -79,10 +79,6 @@ it('increase pool size after resizing the scroller', () => { grid.classList.add('small'); - // Workaround for FF58 rendering issue - grid.size = 0; - grid.size = 200; - grid.style.display = 'none'; expect(grid._physicalItems.length).to.eql(25); diff --git a/test/scroll-to-index.html b/test/scroll-to-index.html index 470178273..00c73ae12 100644 --- a/test/scroll-to-index.html +++ b/test/scroll-to-index.html @@ -150,6 +150,33 @@ }); + describe('Added item', () => { + let grid, scroller, data; + + beforeEach(() => { + grid = fixture('large'); + data = Array(...new Array(10)).map((_, i) => { + return {'index': i}; + }); + + grid.size = 10; + grid.dataProvider = function(params, callback) { + callback(data); + }; + + flushGrid(grid); + }); + + it('should not reassign the first item on scrollToIndex', () => { + const newExpectedSize = grid.size + 1; + grid.size = newExpectedSize; + data.push({'index': 11}); + grid.scrollToIndex(grid.items.length); + + expect(grid.$.items.children[0]._item.index).to.equal(0); + }); + }); + });