Skip to content

Commit

Permalink
Improve check
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Feb 13, 2019
1 parent a91d288 commit a6524f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SnackbarProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class SnackbarProvider extends Component {
*/
handleEnqueueSnackbar = (message, { key, preventDuplicate, ...options } = {}) => {
const shouldPreventDuplicate = preventDuplicate || this.props.preventDuplicate;
const isInQueue = this.queue.filter(item => item.message === message).length > 0;
const isDisplayed = this.state.snacks.filter(item => item.message === message).length > 0;
const isInQueue = !!this.queue.find(item => item.message === message);
const isDisplayed = !!this.state.snacks.find(item => item.message === message);
if (shouldPreventDuplicate && (isInQueue || isDisplayed)) {
return null;
}
Expand Down

0 comments on commit a6524f7

Please sign in to comment.