diff --git a/apps/web/app/SpeculationRules.tsx b/apps/web/app/SpeculationRules.tsx new file mode 100644 index 0000000000..0a14e62d69 --- /dev/null +++ b/apps/web/app/SpeculationRules.tsx @@ -0,0 +1,34 @@ +import Script from "next/script"; + +export function SpeculationRules({ + prefetchPathsOnHover = [], + prerenderPathsOnHover = [], +}: { + prefetchPathsOnHover?: string[]; + prerenderPathsOnHover?: string[]; +}) { + const speculationRules = { + prefetch: [ + { + urls: prefetchPathsOnHover, + eagerness: "moderate", + }, + ], + prerender: [ + { + urls: prerenderPathsOnHover, + eagerness: "moderate", + }, + ], + }; + + return ( +