Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

Commit

Permalink
Filter and update start if props update
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Bækdahl committed May 20, 2019
1 parent 88fa989 commit 216e448
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Searchable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ export default class Searchable<T> extends Component<IProps<T>, IState<T>> {
const {query} = this.state;
const {items} = this.props;

if (items !== prevProps.items) {
this.setState({ items });
}

if (query !== prevState.query) {
if (query !== prevState.query || items !== prevProps.items) {
this.filterAndSetState(items, query);
}
}
Expand Down

0 comments on commit 216e448

Please sign in to comment.