From 64f962dad517a6465d1176c5d546eeb66f9bf6aa Mon Sep 17 00:00:00 2001 From: Smit Barmase Date: Wed, 15 Nov 2023 00:48:04 +0530 Subject: [PATCH] fix --- packages/astro/src/prefetch/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/astro/src/prefetch/index.ts b/packages/astro/src/prefetch/index.ts index 124b53c048a0..573efe5734ef 100644 --- a/packages/astro/src/prefetch/index.ts +++ b/packages/astro/src/prefetch/index.ts @@ -104,7 +104,7 @@ function initHoverStrategy() { clearTimeout(timeout); } timeout = setTimeout(() => { - prefetch(href, { with: 'fetch', ignoreSlowConnection: true }); + prefetch(href, { with: 'fetch' }); }, 80) as unknown as number; } @@ -155,7 +155,7 @@ function createViewportIntersectionObserver() { setTimeout(() => { observer.unobserve(anchor); timeouts.delete(anchor); - prefetch(anchor.href, { with: 'link', ignoreSlowConnection: true }); + prefetch(anchor.href, { with: 'link' }); }, 300) as unknown as number ); } else { @@ -244,8 +244,8 @@ function elMatchesStrategy(el: EventTarget | null, strategy: string): el is HTML } // Fallback to tap strategy if using data saver mode or slow connection - if ((attrValue != null || prefetchAll) && isSlowConnection()) { - return strategy === 'tap'; + if (strategy === 'tap' && (attrValue != null || prefetchAll) && isSlowConnection()) { + return true; } // If anchor has no dataset but we want to prefetch all, or has dataset but no value,