Router problem - browser back button crashes app
Answered
Bombay-duck posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Bombay-duckOP
Hi, I've got a problem and I'm asking you for help, please
(attached video to see what the problem looks like)
NextLink with name "aktualności" is taking me to the main page with address http://localhost:3000/.
As long as I use my navigation (using NextLinks) everything works fine. Whenever I use back button from browser application crashes 😦
I'm stuck 😦
I'm looking forward to your response
Piotr
(attached video to see what the problem looks like)
NextLink with name "aktualności" is taking me to the main page with address http://localhost:3000/.
As long as I use my navigation (using NextLinks) everything works fine. Whenever I use back button from browser application crashes 😦
I'm stuck 😦
I'm looking forward to your response
Piotr
Answered by Bombay-duck
Hi, I finally found what caused the problem.
It was a component that had async function that was a child of a component marked as "use client".
Now I know what to look for, when I see such a crashes 🙂
BTW. It's still a little strange behavior, that the crash occurs only when you use browser's Back button. When you navigate within an app everything works perfectly well, that was a little confusing when debugging.
If you want to reproduce the crash, here's a min repo:
https://github.com/piotr-kozlowski-reps/witosa_min_repo
problematic component is here:
app(site)\components\slider_main\MainSlider.tsx
that is attached to main page.
when you navigate via built navigation, everything works well. When you go back to main page with browser's back button -> app crashes
regards
Piotr
It was a component that had async function that was a child of a component marked as "use client".
Now I know what to look for, when I see such a crashes 🙂
BTW. It's still a little strange behavior, that the crash occurs only when you use browser's Back button. When you navigate within an app everything works perfectly well, that was a little confusing when debugging.
If you want to reproduce the crash, here's a min repo:
https://github.com/piotr-kozlowski-reps/witosa_min_repo
problematic component is here:
app(site)\components\slider_main\MainSlider.tsx
that is attached to main page.
when you navigate via built navigation, everything works well. When you go back to main page with browser's back button -> app crashes
regards
Piotr
4 Replies
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/44415017de6fed2ccd5d44b4b2051ac0.webp?size=256)
joulev
Can you give us a minimal reproduction application?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Bombay-duckOP
sorry - I forgot about the repo 😦
https://github.com/piotr-kozlowski-reps/witosa_next
The minimal reproduction I will be able to start to prepare no sooner as tomorrow 😦
But you may find something obvious at first glance ... maybe.
Strange thing is that everything works perfectly unless I use Back button in browser 😦
https://github.com/piotr-kozlowski-reps/witosa_next
The minimal reproduction I will be able to start to prepare no sooner as tomorrow 😦
But you may find something obvious at first glance ... maybe.
Strange thing is that everything works perfectly unless I use Back button in browser 😦
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Bombay-duckOP
Hi, I finally found what caused the problem.
It was a component that had async function that was a child of a component marked as "use client".
Now I know what to look for, when I see such a crashes 🙂
BTW. It's still a little strange behavior, that the crash occurs only when you use browser's Back button. When you navigate within an app everything works perfectly well, that was a little confusing when debugging.
If you want to reproduce the crash, here's a min repo:
https://github.com/piotr-kozlowski-reps/witosa_min_repo
problematic component is here:
app(site)\components\slider_main\MainSlider.tsx
that is attached to main page.
when you navigate via built navigation, everything works well. When you go back to main page with browser's back button -> app crashes
regards
Piotr
It was a component that had async function that was a child of a component marked as "use client".
Now I know what to look for, when I see such a crashes 🙂
BTW. It's still a little strange behavior, that the crash occurs only when you use browser's Back button. When you navigate within an app everything works perfectly well, that was a little confusing when debugging.
If you want to reproduce the crash, here's a min repo:
https://github.com/piotr-kozlowski-reps/witosa_min_repo
problematic component is here:
app(site)\components\slider_main\MainSlider.tsx
that is attached to main page.
when you navigate via built navigation, everything works well. When you go back to main page with browser's back button -> app crashes
regards
Piotr
Answer