-
-
Notifications
You must be signed in to change notification settings - Fork 296
Open
Description
If preventDuplicate is enabled, calling closeSnackbar and then calling enqueueSnackbar again during the close animation will be ignored.
Expected Behavior
Displayed if enqueueSnackbar is called last when preventDuplicate is enabled.
Current Behavior
Not displayed even if enqueueSnackbar is called last when preventDuplicate is enabled.
const key = enqueueSnackbar(button.message, { variant: button.variant });
closeSnackbar(key);
setTimeout(() => {
// I want it to be displayed but ignored.
enqueueSnackbar(button.message, { variant: button.variant });
}, 100);
Steps to Reproduce
Link:
https://codesandbox.io/s/divine-night-58x2g1?file=/MessageButtons.js:1215-1285
- click button
Context
I have a component that uses React.useEffect to keep showing the snackbar as long as the component is mounted, but it no longer works with React 18 + StrictMode. Only developer mode is affected, but I would like to fix it.
Your Environment
| Tech | Version |
|---|---|
| Notistack | v3.0.1 |
| React | 18.2.0 |
| Browser | Chrome 110.0.5481.177 |
| etc. |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels