fix(Table): prevent reusing row from previous render

This commit is contained in:
kristof0425 2019-09-02 10:36:22 +02:00 committed by 偏右
parent 2228e91b01
commit 2875933c99

View File

@ -89,19 +89,21 @@ const defaultPagination = {
*/ */
const emptyObject = {}; const emptyObject = {};
let row: BodyRowClass; let row: BodyRowClass | undefined;
const createComponents = (components: TableComponents = {}, prevComponents?: TableComponents) => { const createComponents = (components: TableComponents = {}, prevComponents?: TableComponents) => {
const bodyRow = components && components.body && components.body.row; const bodyRow = components && components.body && components.body.row;
const preBodyRow = prevComponents && prevComponents.body && prevComponents.body.row; const prevBodyRow = prevComponents && prevComponents.body && prevComponents.body.row;
if (!row || bodyRow !== preBodyRow) { let Row = row;
row = createBodyRow(bodyRow); row = undefined;
if (!Row || bodyRow !== prevBodyRow) {
Row = createBodyRow(bodyRow);
} }
return { return {
...components, ...components,
body: { body: {
...components.body, ...components.body,
row, row: Row,
}, },
}; };
}; };