Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong description for preventDuplicate in website documentation #612

Open
Extazx2 opened this issue Oct 21, 2024 · 0 comments
Open

Wrong description for preventDuplicate in website documentation #612

Extazx2 opened this issue Oct 21, 2024 · 0 comments

Comments

@Extazx2
Copy link

Extazx2 commented Oct 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant