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

Enabling preventDuplicate causes enque to be ignored during close animation #550

Open
satoren opened this issue Mar 9, 2023 · 2 comments · May be fixed by #559
Open

Enabling preventDuplicate causes enque to be ignored during close animation #550

satoren opened this issue Mar 9, 2023 · 2 comments · May be fixed by #559

Comments

@satoren
Copy link

satoren commented Mar 9, 2023

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

  1. 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.
@seawish369
Copy link

I'm also facing this issue

satoren added a commit to satoren/notistack that referenced this issue Apr 12, 2023
@satoren satoren linked a pull request Apr 12, 2023 that will close this issue
@rulim34
Copy link

rulim34 commented Oct 26, 2023

It's been a while, and this issue is really disturbing me. Could anyone from the maintainer confirm and merge the fix?

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

Successfully merging a pull request may close this issue.

3 participants