NextJS /app router waits for server response before showing 'loading.tsx' #68763
Replies: 3 comments 1 reply
-
|
Same issue #64896. It really looks terrible. |
Beta Was this translation helpful? Give feedback.
-
|
Next js is based on file system based routing so since your login folder is inside (auth) folder, change the link (ie href="/login") in the main page.tsx following src/app folder to auth/login (ie href="/(auth)/login"). |
Beta Was this translation helpful? Give feedback.
-
|
Hi @jake-transcrypts -- instant loading states are powered by prefetching. In dev mode, Next.js does not automatically prefetch pages, because those pages might not be built yet by Webpack/Turbopack and we don't want to initiate a bunch of page compilations which could cause your dev server to slow down. If you build your app and run it with If your login page opted into dynamic rendering, you'd see the behavior you're expecting during CleanShot.2024-08-10.at.09.33.16.mp4Let us know if you have any further questions about this behavior! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Link to the code that reproduces this issue
https://github.com/jake-transcrypts/nextjs-tutorial/
To Reproduce
yarn installyarn devCurrent vs. Expected behavior
Assumptions:
Example scenario
Current behavior:
The URL sits at http://localhost:3000/ for a few seconds, doing nothing, and showing the user no feedback from their action.
Expected behavior:
As soon as the user clicks the link, the URL should shift, or somehow preemptively show a loader that their requested page change is processing.
Provide environment information
Which area(s) are affected? (Select all that apply)
Navigation, Parallel & Intercepting Routes
Which stage(s) are affected? (Select all that apply)
next dev (local), Vercel (Deployed)
Additional context
Follow-up from This Issue #43548
I'm wondering if there's any additional follow-up from the Next team or workarounds that people have found to resolve this issue. This seems like a fairly simple issue, but it's a profoundly bad experience for users when their actions don't get a reaction from a page, and an annoyance as a developer when I need to add loaders to wait for my loaders.
We were gearing up to launch to production before this issue was noticed, and now we're considering downgrading to /pages in order to circumvent this.
Beta Was this translation helpful? Give feedback.
All reactions