Replies: 2 comments 4 replies
-
This happens because static routes don’t re-trigger the loading.tsx during revalidation the page is served instantly from cache until regeneration finishes. Dynamic routes re-fetch on navigation, which is why you see the loading state there. If you want the loading.tsx to appear after revalidatePath(), you can mark that route as dynamic = 'force-dynamic' or set revalidate = 0 so it re-renders on navigation instead of serving the cached version. It’s a tradeoff between showing the loading state and keeping it static. |
Beta Was this translation helpful? Give feedback.
-
This happens because static routes are pre-rendered and cached, so loading.tsx only appears during client-side transitions when data fetching is pending. In your case, after calling revalidatePath("/prompts/list"), the new static asset is generated in the background, and the router doesn’t trigger a suspense boundary — hence no loading.tsx appears. To fix it, you can:
Static routes don’t automatically re-trigger |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have a route like:
I also have a loading.tsx under the same sub-directory. when I create a new prompt I call revalidatePath("/prompts/list"). The issue is when transitioning back to the /prompts/list route it doesn't show the loading.tsx skeleton and just hangs until the data is re-fetched.
This issue only occurs when I use a static route, a dynamic route correctly shows loading.tsx. The issue is that a dynamic route will re-fetch the data every time I transition to it, but I shouldn't need to do this until I explicitly invalidate the route. Any help is appreciated.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions