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 = {};
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,
},
};
};