mirror of
https://github.com/wassname/talk.git
synced 2026-07-14 11:18:50 +08:00
Prevent unnecessary render - no need to clear search if already empty, just close dropdown
This commit is contained in:
@@ -3,6 +3,7 @@ import {compose, gql} from 'react-apollo';
|
||||
import StorySearch from '../components/StorySearch';
|
||||
import {withRouter} from 'react-router';
|
||||
import withQuery from 'coral-framework/hocs/withQuery';
|
||||
import {isEmpty} from 'lodash';
|
||||
|
||||
class StorySearchContainer extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -24,7 +25,9 @@ class StorySearchContainer extends React.Component {
|
||||
}
|
||||
|
||||
clearAndCloseSearch = () => {
|
||||
this.clearSearch();
|
||||
if (!isEmpty(this.state.searchValue)) {
|
||||
this.clearSearch();
|
||||
}
|
||||
this.props.closeSearch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user