Improve data prefetching, less false positives

This commit is contained in:
Tom Moor
2023-05-20 17:11:40 -04:00
parent dbad4a9b84
commit 31b9c2b8a4
3 changed files with 33 additions and 7 deletions

View File

@@ -114,7 +114,7 @@ function InnerDocumentLink(
[expanded]
);
const handleMouseEnter = React.useCallback(() => {
const handlePrefetch = React.useCallback(() => {
prefetchDocument?.(node.id);
}, [prefetchDocument, node]);
@@ -317,7 +317,7 @@ function InnerDocumentLink(
<SidebarLink
expanded={hasChildren ? isExpanded : undefined}
onDisclosureClick={handleDisclosureClick}
onMouseEnter={handleMouseEnter}
onClickIntent={handlePrefetch}
to={{
pathname: node.url,
state: {