Skip to content

Toast is undefined || Uncaught TypeError: Cannot read properties of undefined (reading 'content') #952

@PsyCowpathe

Description

@PsyCowpathe

Hi, thanks in advance for your time !

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

A bug

What is the current behavior?

When displaying notification, if the user change page when a notification is deleted (autoclose or toast.dismiss()) an error occur :

-On firefox : "Toast is undefined" or "T is undefined" folowing the version used.

-On chrome : "Uncaught TypeError: Cannot read properties of undefined (reading 'content')"

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:

On a single page application, display lots of notification with autoclose enabled, wait for some of the oldest notification to close itself then change page.

What is the expected behavior?

The expected behavior is no error when user change from page to page.

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

React : 18.2.0

Toastify :

  • 9.1.2
  • 9.1.1
  • 9.1.0
  • 9.0.8

Os : Ubuntu

Browser :
-Firefox
-Google Chrome

Screenshot :

Firefox :
Screenshot from 2023-05-04 17-30-19

Chrome :
Screenshot from 2023-05-04 17-31-55

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions