React-toastify: toast notifications don't get shown after route-change

Created on 18 Nov 2019  路  5Comments  路  Source: fkhadra/react-toastify

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

What is the current behavior?
toast notifications don't get shown after route-change

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:
dependencies:

  • gatsby
  • /@reach/router

step 1: load page and click "open toast" --> works
step 2: make a route-change
step 3: click "open toast" --> doesn't work
step 4: reload page and click "open toast" --> works again

https://codesandbox.io/s/gatsby-starter-default-lh4o3

What is the expected behavior?
toast notifications should be shown

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
worked in previous version of this package (5.3.2)

Most helpful comment

I solved this issue by putting the ToastContainer inside my highest level component (where my router is), that way all toast function calls are passed into that Container only. I'm guessing what's going on after debugging my app is that the toast message's aren't going to the correct Container when you switch between routes.

All 5 comments

I solved this issue by putting the ToastContainer inside my highest level component (where my router is), that way all toast function calls are passed into that Container only. I'm guessing what's going on after debugging my app is that the toast message's aren't going to the correct Container when you switch between routes.

@herrwitzi hi, getting same error with your exact scenario. this just start to happen after latest version update of gatsby.

@AirrBear it was just like that but nope still not working :(

so anybody? :)

Thanks @AirrBear Your work around working for me.

May I ask you to try with the v5.5.0 if it solve your issue.

Thanks

@fkhadra this issue seems to be fixed with v5.5.0. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JaLe29 picture JaLe29  路  5Comments

LouisCuvelier picture LouisCuvelier  路  3Comments

tobiasfriden picture tobiasfriden  路  3Comments

giocodes picture giocodes  路  3Comments

AllyssonAlas picture AllyssonAlas  路  4Comments