diff --git a/packages/react-bootstrap-table2-toolkit/context.js b/packages/react-bootstrap-table2-toolkit/context.js index 386820f..d12a7f0 100644 --- a/packages/react-bootstrap-table2-toolkit/context.js +++ b/packages/react-bootstrap-table2-toolkit/context.js @@ -48,7 +48,9 @@ class ToolkitProvider extends statelessDrcorator(React.Component) { } onSearch(searchText) { - this.setState({ searchText }); + if (searchText !== this.state.searchText) { + this.setState({ searchText }); + } } /** diff --git a/packages/react-bootstrap-table2-toolkit/src/search/context.js b/packages/react-bootstrap-table2-toolkit/src/search/context.js index 150612b..67935bf 100644 --- a/packages/react-bootstrap-table2-toolkit/src/search/context.js +++ b/packages/react-bootstrap-table2-toolkit/src/search/context.js @@ -20,25 +20,10 @@ export default (options = { searchText: PropTypes.string } - constructor(props) { - super(props); - this.needToSearch = true; - } - - componentWillReceiveProps(nextProps) { - if (nextProps.searchText !== this.props.searchText) { - this.needToSearch = true; - } else { - this.needToSearch = false; - } - } - search() { const { data, columns } = this.props; let { searchText } = this.props; - if (!this.needToSearch) return data; - if (isRemoteSearch()) { handleRemoteSearchChange(searchText); return data;