Next.js Discord

Discord Forum

Next.js page reloads repeatedly after creating a new page (useEffect loop?)

Unanswered
R.paco posted this in #help-forum
Open in Discord
When working in a Next.js App Router project, the page I’m currently on starts reloading many times in dev mode right after I create a new page.tsx file.
The dev server logs show the same route being requested dozens of times in a short period.

This only happens during development and seems related to client-side logic (possibly useEffect, router navigation, or auth/session handling). I suspect a render or navigation loop triggered by Fast Refresh or state/effect dependencies.

I’m looking for help identifying the cause and the correct pattern to fix and prevent this behavior.

17 Replies

try disabling strictMode
also if ur making a page.tsx for a seperate route then no re renders should happen
what page/components am i looking at also there doesn't seem to be dashboards/member ship page
@R.paco
no just in general go to any page create a route of a page create a page.tsx code something on it and save and you will see the issue
Long-horned bees
Also have that problem sometimes, i think its a hot reload problem but especially weird because its not endless but stops seemingly at random
Kawakawa
Can you show your source code?? Usually it will related to useEffect dependencies.
Exact code piece?
@Kawakawa Can you show your source code?? Usually it will related to useEffect dependencies.
Long-horned bees
i dont think so actually, as in if the page is rerendered it doesnt show that in the console like the screenshot shows. i think its more of a hot reload thing or quick rebuilding in dev
Let's see get requests more accurately.
Maybe it will be in infinite loop in api request.
@Kawakawa Or how about ask to Cursor?
Long-horned bees
wdym
Everyhting is there so
yea