From f0fd06a5f5c609c3bc2e2e2b32dbe0edb6c4d4da Mon Sep 17 00:00:00 2001 From: Allen Date: Sat, 11 Aug 2018 15:17:41 +0800 Subject: [PATCH] fix #465 (#470) --- .../react-bootstrap-table2-toolkit/context.js | 4 +++- .../src/search/context.js | 15 --------------- 2 files changed, 3 insertions(+), 16 deletions(-) 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;