Skip to content

Commit 21dd256

Browse files
authored
fix: do not throw error when adding a new row while a column is hidden
1 parent 0b52938 commit 21dd256

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/vaadin-grid/src/vaadin-grid-column.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ export const ColumnBaseMixin = (superClass) =>
310310

311311
/** @private */
312312
__setColumnTemplateOrRenderer(template, renderer, cells) {
313+
// no renderer or template needed in a hidden column
314+
if (this.hidden) {
315+
return;
316+
}
317+
313318
if (template && renderer) {
314319
throw new Error('You should only use either a renderer or a template');
315320
}

packages/vaadin-grid/test/column.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ describe('column', () => {
186186
const details = grid.shadowRoot.querySelector('#items [part~="details-cell"]')._content;
187187
expect(details.textContent).to.equal('row-details');
188188
});
189+
190+
it('should not throw error when adding a new row with a hidden column', () => {
191+
column.hidden = true;
192+
flushGrid(grid);
193+
expect(() => (grid.size = 11)).to.not.throw(Error);
194+
});
189195
});
190196

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

0 commit comments

Comments
 (0)