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]: Docs page renders the Toast multiple times #28641

Open
andra-sava opened this issue Jul 18, 2024 · 0 comments
Open

[Bug]: Docs page renders the Toast multiple times #28641

andra-sava opened this issue Jul 18, 2024 · 0 comments

Comments

@andra-sava
Copy link

Describe the bug

Docs page is rendering the component ToastContainer multiple times. More exactly there will be one for each story section that appears in the docs page.

image

Reproduction link

https://osstotalsoft.github.io/rocket-ui-ts/?path=/docs/components-feedback-toast--docs

Reproduction steps

1. Go to the docs page of our Toast component: https://osstotalsoft.github.io/rocket-ui-ts/?path=/docs/components-feedback-toast--docs
2. Click the button Info Toast, or any other type of toasts.
3. Close the toast that appeared on the screen.
4. Realize that under the first toast will be another one and another one and so on. More exactly there will be one for each story section that appears in the docs page.
5. Alternatively, inspect the Document and get the number of toasts document.getElementsByClassName('Toastify').length
6. Our components solution is open source and the code can be found at: https://github.com/osstotalsoft/rocket-ui-ts

System

Storybook Environment Info:

  System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz
  Binaries:
    Node: 20.15.1 
    Yarn: 4.3.1 
    npm: 9.5.1 
  Browsers:
    Edge: Chromium (126.0.2592.102)

Additional context

Storybook configuration:
📝 main.js: https://github.com/osstotalsoft/rocket-ui-ts/blob/master/.storybook/main.ts
📝 preview.tsx https://github.com/osstotalsoft/rocket-ui-ts/blob/master/.storybook/preview.tsx
📝 Toast.stories.tsx https://github.com/osstotalsoft/rocket-ui-ts/blob/master/src/stories/feedback/Toast/Toast.stories.tsx

😞 What's happening: In my Toast.stories.tsx file, I am exporting 3 stories, which will appear in the docs page plus the presenting section which is by default the first story. So, in this case, 4 ToastContainers are rendered.

😃 Expected behavior: When I open a Toast, only one ToastContainer should be rendered.

PS: We use the toast from 'react-tostify'

Thank you for your help! 🌷

@andra-sava andra-sava changed the title [Bug]: Toast is rendered multiple times [Bug]: Docs page renders the Toast multiple times Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant