diff --git a/src/SnackbarProvider.js b/src/SnackbarProvider.js index 6a3f76a7..c8f99e17 100644 --- a/src/SnackbarProvider.js +++ b/src/SnackbarProvider.js @@ -50,8 +50,12 @@ class SnackbarProvider extends Component { */ enqueueSnackbar = (message, { key, preventDuplicate, ...options } = {}) => { if ((preventDuplicate === undefined && this.props.preventDuplicate) || preventDuplicate) { - const inQueue = this.queue.findIndex(item => item.message === message) > -1; - const inView = this.state.snacks.findIndex(item => item.message === message) > -1; + const compareFunction = (item) => ( + (key || key === 0) ? item.key === key : item.message === message + ) + + const inQueue = this.queue.findIndex(compareFunction) > -1; + const inView = this.state.snacks.findIndex(compareFunction) > -1; if (inQueue || inView) { return null; }