Skip to content

Wrong description for preventDuplicate in website documentation #612

@Extazx2

Description

@Extazx2

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:
image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions