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

Persistent snackbar not (always) closing with closeSnackbar(key) #175

Closed
simonbos opened this issue Oct 1, 2019 · 4 comments
Closed

Persistent snackbar not (always) closing with closeSnackbar(key) #175

simonbos opened this issue Oct 1, 2019 · 4 comments

Comments

@simonbos
Copy link
Contributor

simonbos commented Oct 1, 2019

Expected Behavior

(Persistent) snackbars should be closed and never be displayed when calling closeSnackbar(key).

Current Behavior

When calling closeSnackbar(key), if the snackbar associated with the key is not displayed (but in the queue), the snackbar is not removed from the queue and can be displayed later on. This is especially an issue for persistent snackbars, since they have to be closed programatically, i.e. if the closeSnackbar method is called before the persistent snackbar is displayed, the persistent snackbar is displayed forever.

Steps to Reproduce

Link: https://codesandbox.io/s/notistack-simple-example-96sud
Important part of the code:

const key = this.props.enqueueSnackbar('Persistent snackbar.', {persistent: 'true'});
setTimeout(() => {this.props.closeSnackbar(key)}, 100);
  1. Click 3 times on SUCCESS.
  2. Click 1 time on DEFAULT.
    => wait for a while: the snackbar is never closed.

Context

I was implementing a persistent loading snackbar which comes into view when a certain action is performed. Before the loading snackbar comes into view, other snackbars could pop up. The time when the loading snackbar should dissapear is dependent on the round trip time to the API server.

Your Environment

Tech Version
Notistack 0.9.2
React 16.10.1
Browser Firefox 69.0
@arnaud-cortisse
Copy link

I'm encoutering the exact same problem with:

Tech Version
Notistack 0.9.3
React 16.9.0
Browser Chrome 77.0.3865.90

@simonbos
Copy link
Contributor Author

Any thoughts, @iamhosseindhv ?

@iamhosseindhv
Copy link
Owner

Sorry guys I've been busy with life lately. This shouldn't be a difficult fix. Will try to publish the fix by the end of this week. Thanks for your patience. Any PR is welcome.

@iamhosseindhv
Copy link
Owner

fixed in #189.
soon to be published

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

3 participants