Notistack: closeSnackbar does not work shortly after enqueuing it

Created on 21 May 2020  ·  3Comments  ·  Source: iamhosseindhv/notistack

Expected Behavior

When calling closeSnackbar shortly after enqueuing, it should get closed.

Current Behavior

When closing a snackbar shortly after enqueuing it (0-230ms), it persists and won't get closed.
It seems to work correctly if the entering transition is almost completed, which is round about after 240-250ms.

Steps to Reproduce

  1. Enqueue a keyed snackbar and close it shortly (0-230ms) after that.

    enqueueSnackbar("Some message", {
     key: "test",
     persist: true,
     variant: "default"
    });
    
    window.setTimeout(() => closeSnackbar("test"), 10);
    
  2. Behold the persisting snackbar, which actually should get closed.

You can reproduce / verify the problem on codesandbox.io.

Context

I'm using a snackbar as a progress report, which for some fast commands should get closed a few milliseconds later.

Your Environment

| Tech | Version |
|--------------|--------------------------------|
| Notistack | v0.9.16 |
| React | v16.13.1 |
| Browser | Google Chrome (v81.0.4044.129) |
| Material-UI | v4.9.14 |

Most helpful comment

Oops sorry @gareon I thought I'd published it 🤦🏻‍♂️
Thanks you for your patience. Fix is now published as 0.9.17

All 3 comments

Thanks for reporting this @Gareon.
Fixed in https://github.com/iamhosseindhv/notistack/pull/280 and will be published as v0.9.17

@iamhosseindhv
Sorry to bother you, but until when can we expect the release? This fix would reduce a lot of work-arounds we had to introduce.

Thank you :)

Oops sorry @gareon I thought I'd published it 🤦🏻‍♂️
Thanks you for your patience. Fix is now published as 0.9.17

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lsansaa picture lsansaa  ·  7Comments

james-cordeiro picture james-cordeiro  ·  6Comments

nebojsanb picture nebojsanb  ·  3Comments

alexisab picture alexisab  ·  5Comments

fdemello picture fdemello  ·  8Comments