Prefetch weird behavior
Unanswered
Orinoco Crocodile posted this in #help-forum
Orinoco CrocodileOP
I have an app that has Links without the prefetch prop specified, I also don't have a loading.js/ts file in the route I have linked to.
What I see is that if I don't have prefetch and let the default behavior, it prefetches it, but then ends up fetching it again when the link is clicked (even in prod I made sure this isn't dev). This seems to defeat the purpose of the prefetch in the first place.
Whereas otherwise if I specify explicit
What I see is that if I don't have prefetch and let the default behavior, it prefetches it, but then ends up fetching it again when the link is clicked (even in prod I made sure this isn't dev). This seems to defeat the purpose of the prefetch in the first place.
Whereas otherwise if I specify explicit
prefetch={true}
it prefetches and doesn't trigger an additional fetch on navigating via the link. I would have thought this would be the default behavior in the first place given I do'nt have a loading.js file so it should be prefetching just fine even without this. Any ideas?1 Reply
This is the intended behavior, Links by default prefetch the all the pages for all the Links that appear on the viewport up to the nearest Suspense boundary down the tree, but this prefetch only last for a little time and if by the time you click the link that time window has passed, it will pre-fetch the page again when you hover on the Link, only for that specific route this time.
There’s no way to disable this behavior, and I don’t recommend you turn it off
There’s no way to disable this behavior, and I don’t recommend you turn it off