-
-
Notifications
You must be signed in to change notification settings - Fork 298
Description
Expected Behavior
Based on documentation: https://notistack.com/features/basic#prevent-duplicate
Set preventDuplicate to true to prevent Snackbars with the same message to be displayed multiple times. If a user-defined key is passed in the options of enqueueSnackbar, then this prevents snackbars with the same key to be displayed multiple times.
I would expect preventDuplicate to prevent snackbars with identical keys to appear
Current Behavior
It's actually duplicate messages that are prevented
Based on react warnings, and jsDoc of the lib, it makes sense that the key prop should be unique, however it may be confusing when looking at the online documentation
Please note that the JSDoc is actually correct:
And console warnings should let users know something is off, when they use identical keys:
Warning: Encountered two children with the same key, "test-success-key-success". Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.