Next.js Discord

Discord Forum

not-found.tsx: need to click at Link component twice to go to home page

Unanswered
Tomistoma posted this in #help-forum
Open in Discord
TomistomaOP
Hi there, everyone!

I'm using dynamic routes with
export function generateStaticParams() {...}
export const dynamic = 'error'
export const dynamicParams = false

I've also created a not-found.tsx. In this file, I've put a Next.js Link component with href="/". When I visit a page that doesn't exist and not-found.tsx is served, I'm having to click at the Link twice to go to the home page. Why's that?

Another thing is that I'm getting a 404 error message at the browser console. I thought this wouldn't show up since I'm using not-found.tsx. Am I doing something wrong?

Thanks in advance!

3 Replies

TomistomaOP
This is the message showing at the browser console. I'd like to not show this somehow. Is it possible or not-found.tsx only works that way?
TomistomaOP
Sometimes it goes to the home page after clicking once. Sometimes I click N times and it doesn't go there, even though the browser's URL has changed to the home page URL.
TomistomaOP
I've fixed the Link issue by upgrading the Next.js package. It remains the issue of the browser console message.