veryfront 0.1.845 → 0.1.847
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/deno.js +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.js +13 -7
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cA+0B3B,CAAC"}
|
|
@@ -628,9 +628,19 @@ export const getRouterScript = () => `
|
|
|
628
628
|
// Prefetching on hover
|
|
629
629
|
// ============================================
|
|
630
630
|
let prefetchTimeout = null;
|
|
631
|
+
let currentHoverLink = null;
|
|
631
632
|
const prefetchedPaths = new Set();
|
|
632
633
|
const inFlightPrefetches = new Set();
|
|
633
634
|
|
|
635
|
+
function cancelScheduledPrefetch() {
|
|
636
|
+
if (prefetchTimeout) {
|
|
637
|
+
clearTimeout(prefetchTimeout);
|
|
638
|
+
prefetchTimeout = null;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
currentHoverLink = null;
|
|
642
|
+
}
|
|
643
|
+
|
|
634
644
|
function getPageDataModulePaths(pageData) {
|
|
635
645
|
const layoutPaths = (pageData.layouts || []).map((l) => l.path).filter(Boolean);
|
|
636
646
|
const allPaths = [pageData.pagePath, ...layoutPaths].filter(Boolean);
|
|
@@ -660,6 +670,7 @@ export const getRouterScript = () => `
|
|
|
660
670
|
}
|
|
661
671
|
|
|
662
672
|
function prefetchPage(href) {
|
|
673
|
+
if (isNavigating) return;
|
|
663
674
|
if (prefetchedPaths.has(href) || inFlightPrefetches.has(href)) return;
|
|
664
675
|
|
|
665
676
|
const cachedPageData = getCachedPageData(href);
|
|
@@ -780,11 +791,10 @@ export const getRouterScript = () => `
|
|
|
780
791
|
}
|
|
781
792
|
|
|
782
793
|
e.preventDefault();
|
|
794
|
+
cancelScheduledPrefetch();
|
|
783
795
|
void navigateSPA(href, true);
|
|
784
796
|
});
|
|
785
797
|
|
|
786
|
-
let currentHoverLink = null;
|
|
787
|
-
|
|
788
798
|
document.addEventListener(
|
|
789
799
|
'mouseenter',
|
|
790
800
|
(e) => {
|
|
@@ -819,11 +829,7 @@ export const getRouterScript = () => `
|
|
|
819
829
|
const relatedTarget = e.relatedTarget;
|
|
820
830
|
if (currentHoverLink && relatedTarget && currentHoverLink.contains(relatedTarget)) return;
|
|
821
831
|
|
|
822
|
-
|
|
823
|
-
clearTimeout(prefetchTimeout);
|
|
824
|
-
prefetchTimeout = null;
|
|
825
|
-
}
|
|
826
|
-
currentHoverLink = null;
|
|
832
|
+
cancelScheduledPrefetch();
|
|
827
833
|
},
|
|
828
834
|
true
|
|
829
835
|
);
|