Gatsby Link: Perform high-priority prefetch on touchstart #38588
Unanswered
sebashine-branly
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
By browsing https://github.com/gatsbyjs/gatsby/discussions?discussions_q=is%3Aopen+prefetch, there are lots of good ideas and suggestions that I don't want to paraphrase here but are worth a read.
My understanding of
gatsby-link
(based on the awesome documentation and by reading some discussions/issues and the source code) is that it allows pre-fetching of links on two levels.I'll over-simplify here by pretending
touch
events are for mobile whereasmouse
events are on desktop. I will stand corrected if this simplification is too much.___loader
callenqueue
onmouseenter
hovering
Additionally, Gatsby Browser API contains
disableCorePrefetching
which seems to disable the low prefetch, but does not affect the high prefetch.Piggybacking on this comment, I think that the exact same code from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-link/src/index.js for
onMouseEnter
could be applied toonTouchStart
. In other words, it should listen totouchstart
events and call___loader.hovering
.There are two advantages:
disableCorePrefetching
, the users on touch-only devices now have a high-priority prefetch happening as welldisableCorePrefetching
, the users on touch-only devices have a high-priority prefetch happening at the time the user showed a strong intent of navigating to a client-side linkIn short, this feature request is about offering consistency for touch-only devices, compared to users with a device handling
mouse
events.I am looking forward to hearing your opinion.
Beta Was this translation helpful? Give feedback.
All reactions