From 644468cf7058fee549fcfb3920969234e9dcc529 Mon Sep 17 00:00:00 2001 From: Meike Grewing Date: Thu, 5 Dec 2019 14:16:41 +0100 Subject: [PATCH 1/2] Add failing unit test --- packages/table/test/tableTests.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/table/test/tableTests.tsx b/packages/table/test/tableTests.tsx index 6d07b8ff9d..fe0ab4bfbb 100644 --- a/packages/table/test/tableTests.tsx +++ b/packages/table/test/tableTests.tsx @@ -582,6 +582,24 @@ describe("", 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( From 7c8c5e10808efa753b41f18a2d0c8ed975c56e59 Mon Sep 17 00:00:00 2001 From: Meike Grewing Date: Tue, 10 Dec 2019 18:47:40 +0100 Subject: [PATCH 2/2] Invalidate grid if dimensions don't match props --- packages/table/src/table.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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