Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Next.js not-found infinite reload loop

Tags:

next.js

I'm using next 13.4.4 with app router. I've added not-found.tsx component to app directory, basically just copied code from next documentation:

import Link from 'next/link'
 
export default function NotFound() {
  return (
    <div>
      <h2>Not Found</h2>
      <p>Could not find requested resource</p>
      <p>
        View <Link href="/">all posts</Link>
      </p>
    </div>
  )
}

The problem is, when I navigate to not existing route, 404 page renders correctly, but inifintely reloads.

tl;dr: I've wrote not-found.tsx component. Expected it to just display not found page, but it reloads infinitely.

like image 639
Alex Avatar asked Feb 03 '26 04:02

Alex


1 Answers

"Is this in development mode? If so, that's expected behaviour for the 404 page. It shouldn't behave like that in production."

Thanks juliomalves. Yeah, it was in development mode.

p.s. Weird expected behavior imho, idk why they made it like that.

like image 116
Alex Avatar answered Feb 13 '26 13:02

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!