Add onPrefetch
to Link
#12375
ryanflorence
announced in
Official RFCs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We can prefetch loader data because we simply use html
<link rel="prefetch" />
and then the browser manages the cache with HTTP. We get requests to prefetch client loaders too but then we'd need a cache to store them (and expire them) etc.Instead, I think we can add a very simple event to links:
onPrefetch
.Apps can simply do whatever they'd like there, probably call
prefetch
on whatever cache they're using (like React Query).This way we can still prefetch the JS modules and they can prefetch everything else.
Signature
I don't think it needs any arguments because they should have everything they need in scope already:
Beta Was this translation helpful? Give feedback.
All reactions