Next.js Discord

Discord Forum

Result from router.prefetch not used on navigation

Unanswered
Yacare Caiman posted this in #help-forum
Open in Discord
Yacare CaimanOP
Does anyone know under what conditions a dynamic route that has been prefetched with router.prefetch will be fetched again when navigating to it?

When I do a simple test with a fresh create-next-app, I see the expected behavior: if I call router.prefetch(href) followed by a navigation to href, I only see one fetch request to the server for the route.

However, in my application I am seeing a separate fetch request made on navigation. I am trying to isolate what's different between the two, and looking for any pointers (e.g. middleware, the use of dynamic functions, parallel routes, etc).

4 Replies

have you by any chance modified the [stale times config](https://nextjs.org/docs/app/api-reference/next-config-js/staleTimes) or are you using nextjs 15rc?
Yacare CaimanOP
Great question! Yes, I have modified it as follows:

    staleTimes: {
      static: 15 * 60,
    },
  }


I am on the latest canary.
i havent really tested it, but i know canary/15rc changed lots of caching defaults to not use prefetched data as much
so sadly i cant really help, but i hope someone can!