From f020440079537782df926a418f349b4f9e8e0740 Mon Sep 17 00:00:00 2001 From: Vaadin Bot Date: Tue, 7 May 2024 15:36:13 +0200 Subject: [PATCH] fix: do not call renderer for disconnected columns (#7389) (#7391) Co-authored-by: Serhii Kulykov --- packages/grid/src/vaadin-grid-mixin.js | 3 +++ packages/grid/test/tree-toggle.common.js | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/packages/grid/src/vaadin-grid-mixin.js b/packages/grid/src/vaadin-grid-mixin.js index 564767c74a..fd6d3a1de8 100644 --- a/packages/grid/src/vaadin-grid-mixin.js +++ b/packages/grid/src/vaadin-grid-mixin.js @@ -932,6 +932,9 @@ export const GridMixin = (superClass) => this._filterDragAndDrop(row, model); iterateChildren(row, (cell) => { + if (cell._column && !cell._column.isConnected) { + return; + } if (cell._renderer) { const owner = cell._column || this; cell._renderer.call(owner, cell._content, owner, model); diff --git a/packages/grid/test/tree-toggle.common.js b/packages/grid/test/tree-toggle.common.js index 82f0ca9971..b33fb8b39f 100644 --- a/packages/grid/test/tree-toggle.common.js +++ b/packages/grid/test/tree-toggle.common.js @@ -169,6 +169,13 @@ describe('tree toggle', () => { expect(getBodyCellContent(grid, 0, 0).firstElementChild).to.equal(toggle); }); + it('should not throw when removing column and setting items', () => { + expect(() => { + grid.removeChild(column); + grid.items = [{ name: 'New name' }]; + }).to.not.throw(Error); + }); + describe('itemHasChildrenPath', () => { beforeEach(() => { sinon.stub(console, 'warn');