Skip to content

Commit

Permalink
feat(core): prefetch on mobile touchstart (#8109)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaiyan-dev authored and slorber committed Oct 28, 2022
1 parent 5e072f0 commit 9063488
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/docusaurus/src/client/exports/Link.tsx
Expand Up @@ -117,7 +117,7 @@ function Link(
}
};

const onMouseEnter = () => {
const onInteractionEnter = () => {
if (!preloaded.current && targetLink != null) {
window.docusaurus.preload(targetLink);
preloaded.current = true;
Expand Down Expand Up @@ -159,7 +159,8 @@ function Link(
) : (
<LinkComponent
{...props}
onMouseEnter={onMouseEnter}
onMouseEnter={onInteractionEnter}
onTouchStart={onInteractionEnter}
innerRef={handleRef}
to={targetLink}
// Avoid "React does not recognize the `activeClassName` prop on a DOM
Expand Down

0 comments on commit 9063488

Please sign in to comment.