Next.js Discord

Discord Forum

pages useRouter and SSR pages

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hey guys I stumbled upon similar situation explained in this topic
https://github.com/vercel/next.js/discussions/11650#discussioncomment-8213155
How the heck is possible that
I assume the reason is that the component unmounts before routerChangeComplete fires, so the listener is removed before the event fires

Her suggestion using routeChangeComplete without cleanup fn works, but I would like to know why?

2 Replies

Brown bearOP
Guys I'm really curious about this, is this maybe bug in next,js?

And also one more statment I'm not sure about, is component in app.js being unmouted?
Brown bearOP
bump