Check if Table[pagination] exist

When pagination is null, a error "Cannot use 'in' operator to search for 'current' in null"
will raise.
This commit is contained in:
Wei Zhu
2017-03-02 11:31:56 +08:00
parent 63c6977829
commit 570e2ce1dc
+3 -1
View File
@@ -516,7 +516,9 @@ export default class Table<T> extends React.Component<TableProps<T>, any> {
pagination,
};
// Controlled current prop will not respond user interaction
if (typeof props.pagination === 'object' && 'current' in (props.pagination as Object)) {
if (props.pagination &&
typeof props.pagination === 'object' &&
'current' in (props.pagination as Object)) {
newState.pagination = assign({}, pagination, {
current: this.state.pagination.current,
});