Remove the side effects in render method (#10357)

This commit is contained in:
Zheeeng 2018-05-04 17:37:31 +08:00 committed by niko
parent 0f7794946f
commit 7f8cb838e3

View File

@ -196,9 +196,12 @@ export default class List extends React.Component<ListProps> {
[`${prefixCls}-something-after-last-item`]: this.isSomethingAfterLastItem(),
});
this.defaultPaginationProps.total = dataSource.length;
this.defaultPaginationProps.current = paginationCurrent;
const paginationProps = { ...this.defaultPaginationProps, ...pagination };
const paginationProps = {
...this.defaultPaginationProps,
total: dataSource.length,
current: paginationCurrent,
...pagination,
};
const largestPage = Math.ceil(
paginationProps.total / paginationProps.pageSize,
);