Skip to content

Commit cb1e821

Browse files
Don't run renderers for missing header/footer cells (#1735) (#1736)
Co-authored-by: Tomi Virkki <[email protected]>
1 parent e9474d7 commit cb1e821

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/vaadin-grid-column.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@
235235
}
236236

237237
_renderHeaderAndFooter() {
238-
if (this.headerRenderer) {
238+
if (this.headerRenderer && this._headerCell) {
239239
this.__runRenderer(this.headerRenderer, this._headerCell);
240240
}
241-
if (this.footerRenderer) {
241+
if (this.footerRenderer && this._footerCell) {
242242
this.__runRenderer(this.footerRenderer, this._footerCell);
243243
}
244244
}

test/column.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,22 @@
182182
expect(spy.called).to.be.false;
183183
});
184184

185-
it('should dettach cells from a hidden column', () => {
185+
it('should detach cells from a hidden column', () => {
186186
const childCountBefore = grid.childElementCount;
187187
column.hidden = true;
188188
const childCountAfter = grid.childElementCount;
189189
expect(childCountAfter).to.be.below(childCountBefore);
190190
});
191+
192+
it('should not throw on render with initially hidden columns with header/footerRenderer', () => {
193+
const newColumn = document.createElement('vaadin-grid-column');
194+
newColumn.hidden = true;
195+
newColumn.headerRenderer = () => {};
196+
newColumn.footerRenderer = () => {};
197+
grid.appendChild(newColumn);
198+
flushGrid(grid);
199+
expect(() => grid.render()).not.to.throw(Error);
200+
});
191201
});
192202

193203
describe('path', () => {

0 commit comments

Comments
 (0)