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

Toaster push is showing unexpected behaviour when called from useEffect #2336

Closed
utkarsh-alphonso opened this issue Jan 30, 2022 · 3 comments

Comments

@utkarsh-alphonso
Copy link

utkarsh-alphonso commented Jan 30, 2022

What version of rsuite are you using?

5.5.2

What version of React are you using?

17.0.0

What version of TypeScript are you using (if any)?

No response

What browser are you using?

Chrome

Describe the Bug

In the useEffect of my form component, I trigger a notification for successful/unsuccessful submit. With rsuite v4, I had it working fine. But as soon as I migrated to v5, replacing the earlier Notification format with the one using toaster - I am encountering a bug as follows:

Uncaught TypeError: Cannot read properties of null (reading 'push')
which points to the line

return container.current.push(message)
(inside the toaster.push function)

Some other observations: If I trigger the notification from a button callback - it works. Infact once I trigger it from a callback, even the useEffect triggers work fine. Please help!

Expected Behavior

No response

To Reproduce

No response

@simonguo
Copy link
Member

simonguo commented Feb 9, 2022

hi @utkarsh-alphonso , can you reproduce your problem with codesandbox?

@maxpou
Copy link
Contributor

maxpou commented Feb 14, 2022

@simonguo I have the same issue. Any workaround?

https://codesandbox.io/s/festive-wozniak-vk379?file=/src/index.js

Edit: if you comment the line 14 on this sandbox and click the button, you will see the message: Cannot read properties of null (reading 'push').

maxpou added a commit to maxpou/rsuite that referenced this issue Feb 14, 2022
maxpou added a commit to maxpou/rsuite that referenced this issue Feb 14, 2022
maxpou added a commit to maxpou/rsuite that referenced this issue Feb 14, 2022
maxpou added a commit to maxpou/rsuite that referenced this issue Feb 15, 2022
@SevenOutman
Copy link
Member

Closed via #2353

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

4 participants