diff --git a/components/table/filterDropdown.tsx b/components/table/filterDropdown.tsx index 32f5e36a6a..2c16b1e38b 100755 --- a/components/table/filterDropdown.tsx +++ b/components/table/filterDropdown.tsx @@ -39,16 +39,17 @@ export default class FilterMenu extends React.Component { componentWillReceiveProps(nextProps) { const { column } = nextProps; - let newState; + let newState: { + selectedKeys?: string[]; + visible?: boolean; + } = {}; if ('selectedKeys' in nextProps) { - newState = newState || {}; newState.selectedKeys = nextProps.selectedKeys; } if ('filterDropdownVisible' in column) { - newState = newState || {}; newState.visible = column.filterDropdownVisible; } - if (newState) { + if (Object.keys(newState).length > 0) { this.setState(newState); } }