Skip to content

Commit

Permalink
Merge pull request #77 from mef/patch-1
Browse files Browse the repository at this point in the history
fix: Prevent adding current page as prefetch link
  • Loading branch information
JulianCataldo committed Apr 12, 2023
2 parents 2c07b5c + 8ff5923 commit e6ed43c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/HoverPrefetch/HoverPrefetch.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (typeof props.max !== 'number') {
if (e.target.tagName === 'A' && prefetchList.length < max) {
const url = e.target.getAttribute('href');

if (url.startsWith('/')) {
if (url.startsWith('/' && url !== window.location.pathname )) {
if (prefetchList.includes(url) === false) {
// console.log(`prefetching url ${url}`);
const link = document.createElement('link');
Expand Down

0 comments on commit e6ed43c

Please sign in to comment.