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

Cannot read properties of undefined (reading 'props') at deleteToast #1053

Closed
jeymus opened this issue Jan 29, 2024 · 8 comments
Closed

Cannot read properties of undefined (reading 'props') at deleteToast #1053

jeymus opened this issue Jan 29, 2024 · 8 comments

Comments

@jeymus
Copy link

jeymus commented Jan 29, 2024

🐛Bug

TypeError: Cannot read properties of undefined (reading 'props') at deleteToast in withTranslation.js

This error appears on v10.0.0 and above, and is triggered when the toast is dismissed immediately after rendering.
This is a similar issue to one that was previously fixed in v9.1.3 but it has now appeared again. I have tested on v9.1.3 with no issues.
v9.1.3's release note:

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

Basic example:

const handleClick = async (e) => {
    const toastId = toast.loading('Loading')
    try {
        return console.log('Test log')
    }
    catch (error) {
        console.error(error)
    }
    finally {
        toast.dismiss(toastId)
    }
}
@duythinh-dev
Copy link

Any solution on this?
I'm facing the same problem

@arenier
Copy link

arenier commented Jun 7, 2024

Same issue here

@gajraj-gan
Copy link

Same

@abdullahhjiim
Copy link

same issue here

@dolev7
Copy link

dolev7 commented Jun 24, 2024

same

@bhimeshchauhan
Copy link

bump

@Souvik2003K
Copy link

wherever in your code you want to manually close the toast just put this code(mine worked) -

if (toast.isActive(null)) { // Check if any toast is active
    toast.dismiss();
} else {
    console.warn("Toast not found for dismissal");
}

@bhimeshchauhan
Copy link

For me, the issue was:

  • There were multiple toasts being created in the container
    • Adding enableMultiContainer and containerId="<unique-id>" helped
  • The toast was being closed before it opened
    • Adding timeout to close, helped

@fkhadra fkhadra closed this as completed Nov 25, 2024
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

9 participants