diff --git a/packages/table/src/table.tsx b/packages/table/src/table.tsx index 6de32fc3d0..35373f7215 100644 --- a/packages/table/src/table.tsx +++ b/packages/table/src/table.tsx @@ -810,6 +810,10 @@ export class Table extends AbstractComponent2", function(this) { expect(onCompleteRenderSpy.callCount, "call count on update").to.equal(2); }); + it("does not try to render cells that no longer exist", () => { + const onCompleteRenderSpy = sinon.spy(); + let numRows = 2; + const cellRenderer = (rowIndex: number) => { + if (rowIndex >= numRows) { + throw new Error(`There is no row with index ${rowIndex}`); + } + return Row ${rowIndex}; + }; + const table = mount( + + +
, + ); + numRows = 1; + expect(() => table.setProps({ numRows })).does.not.throw(); + }); + it("triggers immediately on mount with RenderMode.BATCH_ON_UPDATE", () => { const onCompleteRenderSpy = sinon.spy(); mount(