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

BUG: sometimes toasts do not unstack on hover #98

Open
bw1984 opened this issue Nov 1, 2024 · 2 comments
Open

BUG: sometimes toasts do not unstack on hover #98

bw1984 opened this issue Nov 1, 2024 · 2 comments

Comments

@bw1984
Copy link

bw1984 commented Nov 1, 2024

Its difficult to show this but sometimes if i trigger toasts in quick succession, they visually stack as expected but then do not 'unstack' when i hover over them. This only seems to happen if they are triggered/created in very quick succession (which can sometimes be difficult to avoid if they are being triggered by background activities which are happening at random intervals)

@CMarzin
Copy link
Contributor

CMarzin commented Dec 4, 2024

A workaround for this "bug" is to wrap the creation of the toast in a setTimeOut, even with 0ms it fix the bug.

Here a reproduction of the unstack bug with the latest version :

const toastConfig = [
  {
    title: 'warning toast',
    description: 'ceci est une warning',
  },
  {
    title: 'warning toast',
    description: 'ceci est un warning',
  },
];

  for (let i = 0; i < toastConfig.length; i++) {
    const config = toastConfig[i];
      toast.warning(config.title, {
        description: config.description,
      });
  }

If you add a setTimeOut, the unstack works as expected :

  for (let i = 0; i < toastConfig.length; i++) {
    const config = toastConfig[i];
    setTimeout(() => {
      toast.warning(config.title, {
        description: config.description,
      });
    }, 0);
  }

Anyone got an idea of why this is happening ?

@FallingEpiphany
Copy link

Same,I check files' type in a for loop, and got sonners stacked together without spacing, creating a very heavy shadow, while few of the sonners are not fixed in this pile and is displayed normally, unstack normally.

 for (const file of Array.from(files)) {
        console.debug("Adding file:", index++, file);
        if (!fileTypeFilter(file)) {
            toast.warning("不可上传该类型文件", {
                description: file.name,
                id: file.name,
            });
            continue;
        }

Image

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