question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v6 - Limit number of toasts issue

See original GitHub issue

Do you want to request a feature or report a bug? Report bug

What is the current behavior?

<ToastContainer 
    transition={Flip} 
    limit={5}
    toastClassName="toast--base"
    closeOnClick={false}
 />

I would expect this to limit to only 5 toasts at a time. But, if I spam the toast button, it will limit to only 5 toasts until one of the toasts time-out and dissappear… At this time the limit seems to not be working and I can display lots of toasts.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

Screen Shot 2020-04-28 at 10 21 13 AM

I think that my description in current behavior is sufficient for someone to recreate the bug.

What is the expected behavior? I expect for the limit of toasts to work even if the toast button is being spammed.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Mac OS Chrome

Package versions

{
  "name": "react-ui",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@starbucks/pattern-library": "20.2.0",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "@types/jest": "^24.9.1",
    "@types/node": "^12.12.37",
    "@types/react": "^16.9.34",
    "@types/react-dom": "^16.9.6",
    "node-sass": "4.13.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-redux": "7.2.0",
    "react-scripts": "3.4.1",
    "react-toastify": "6.0.0-rc.0",
    "redux": "4.0.5",
    "typescript": "^3.7.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
fkhadracommented, Apr 29, 2020

@coltenkrauter I found a way to fix the issue. I need to clean the code first and I’ll publish the fix in the coming days.

1reaction
fkhadracommented, Apr 28, 2020

@coltenkrauter I’ve been able to reproduce the issue but your really need to click like crazy 🤣. I’ll check what is goiing on under the hood. Thanks for reporting the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feat: Limit the number of toast displayed at the same time ...
What is the expected behavior? Props to limited toast showing. Which versions of React, and which browser / OS are affected by this...
Read more >
Limit the number of toast displayed | React-Toastify
Limit the number of toast displayed ... Notifications are useful to get the attention of the user. But displaying too many of them...
Read more >
Toasts are disabled if notifications are ... - Issue Tracker - Google
A very bad and unwanted side effect is that once notifs are disabled, Toast messages are also disabled, even when the user is...
Read more >
ion-toast Component: A Dismissible App Notification Alert
The toast can be dismissed automatically after a specific amount of time by passing the number of milliseconds to display it in the...
Read more >
[UWP]Length limits to number of lines and characters ... - MSDN
Hey Peshva,. Toasts can only have up to 3 text elements. Sorry for the confusion in the article, we'll work on updating it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found