feat(core): prefetch on mobile touchstart (#8109)

This commit is contained in:
Sanjaiyan Parthipan 2022-09-28 16:29:08 +05:30 committed by GitHub
parent 029893fea2
commit f7c3af9102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ function Link(
}
};
const onMouseEnter = () => {
const onInteractionEnter = () => {
if (!preloaded.current && targetLink != null) {
window.docusaurus.preload(targetLink);
preloaded.current = true;
@ -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