From 2875933c9988e82f20cb4723a843a4c7e6eccedd Mon Sep 17 00:00:00 2001 From: kristof0425 Date: Mon, 2 Sep 2019 10:36:22 +0200 Subject: [PATCH] fix(Table): prevent reusing row from previous render --- components/table/Table.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 8358d6f498..9480cb25c0 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -89,19 +89,21 @@ const defaultPagination = { */ const emptyObject = {}; -let row: BodyRowClass; +let row: BodyRowClass | undefined; const createComponents = (components: TableComponents = {}, prevComponents?: TableComponents) => { const bodyRow = components && components.body && components.body.row; - const preBodyRow = prevComponents && prevComponents.body && prevComponents.body.row; - if (!row || bodyRow !== preBodyRow) { - row = createBodyRow(bodyRow); + const prevBodyRow = prevComponents && prevComponents.body && prevComponents.body.row; + let Row = row; + row = undefined; + if (!Row || bodyRow !== prevBodyRow) { + Row = createBodyRow(bodyRow); } return { ...components, body: { ...components.body, - row, + row: Row, }, }; };