Next.js Discord

Discord Forum

How to prevent notFound function calling on every route change

Unanswered
utsav-flex posted this in #help-forum
Open in Discord
yesterday i have created one fresh next js project with app router, and its version is 15.0.3, and also i have created four routes like (https://prnt.sc/ppQYaFBq7aLm) : root-page, aboutus, blog, contactus, services. and not-found.js, and inside blog page i have done one public api call.

My issue: if i am trying to navigate from one page to another page then everytime notFound function calling itself, you can see server side log (https://prnt.sc/TUBHxkdQxl2D), and also i have putted one log in not-found.js file (https://prnt.sc/n3KWADqH3274).

24 Replies

are you calling the component somewhere?
manually
yes, inside blog page (https://prnt.sc/EppTiJ7Ev_19)
cool
but if u go on the blog page, are you getting a 404 or no?
no, i am not getting 404, data is comes properly (https://prnt.sc/YrLnxP6t9GkM).
weirdus
can u clear your browser cache?
full clear
okay, let me try it.
no, after clearing cache, still i am facing same issue.
u correctly cleared it right?
holding the reload button while the console is open and going on reset cache
last option
hello @gin, you have any idea for my issue ?

if you want to debug by code, here i am providing my project git repo url: https://github.com/utsav-flex/test-project/tree/master

can you check my git repo ?
yes, i am still facing issue, so please check my code.
hello @gin