Skip to content

Commit

Permalink
Disable link prefetch
Browse files Browse the repository at this point in the history
Only fetch on hover to save infra resources. Closes #536
  • Loading branch information
stscoundrel committed May 19, 2024
1 parent 830b191 commit f3ea77d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Breadcrumbs({ type, content }) {
<nav className={styles.section}>
<div className="container">
{breadcrumbs.map(({ label, url }) => (
<Link key={url} href={url} className={styles.link}>
<Link key={url} href={url} className={styles.link} prefetch={false}>
{label}
</Link>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Navigation({ letters, noSearch = false }) {
<div className={styles.topBarSpacer}></div>
<nav className={styles.section}>
<div className={`${styles.topbar} container`}>
<Link href="/" legacyBehavior>
<Link href="/" legacyBehavior prefetch={false}>
<img src="/favicon-48x48.png" width="30" height="30" alt="To home" loading="lazy" />
</Link>
<Hamburger action={openNav} />
Expand Down
14 changes: 7 additions & 7 deletions src/components/SampleText/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default function SampleText() {
</p>
<p>
<em>
En <Link href="/word/er">er</Link> <Link href="/word/thessi">þessi</Link> <Link href="/word/tidindi">tíðindi</Link> <Link href="/word/verda-2">verða</Link>, <Link href="/word/tha-2">þá</Link>
<Link href="/word/standa">stendr</Link> <Link href="/word/upp">upp</Link> Heimdallr <Link href="/word/ok">ok</Link> <Link href="/word/blasa-2">blæss</Link> <Link href="/word/a-kafliga">ákafliga</Link> í <Link href="/word/gjoll">Gjallar</Link><Link href="/word/horn">horn</Link> <Link href="/word/ok">ok</Link> <Link href="/word/vekja">vekr</Link> <Link href="/word/upp">upp</Link> <Link href="/word/allr">ǫll</Link> <Link href="/word/god">guðin</Link>, <Link href="/word/ok">ok</Link> <Link href="/word/eiga">eiga</Link> þau <Link href="/word/thing">þing</Link> <Link href="/word/saman">saman</Link>
. <Link href="/word/tha-2">þá</Link> <Link href="/word/rida-3">ríðr</Link> <Link href="/word/odinn">Óðinn</Link> <Link href="/word/til">til</Link> <Link href="/word/mimir">Mímisbrunns</Link> <Link href="/word/ok">ok</Link> <Link href="/word/taka">tekr</Link> <Link href="/word/rada">ráð</Link> <Link href="/word/af">af</Link> <Link href="/word/mimir">Mími</Link> <Link href="/word/fyrir">fyrir</Link> <Link href="/word/ser">sér</Link> <Link href="/word/ok">ok</Link> sínu <Link href="/word/lidi">liði</Link>
. <Link href="/word/tha-2">þá</Link> <Link href="/word/skelfr">skelfr</Link> <Link href="/word/askr">askr</Link> Yggdrasils, <Link href="/word/ok">ok</Link> engi <Link href="/word/hlutr">hlutr</Link> <Link href="/word/er">er</Link> <Link href="/word/tha-2">þá</Link> <Link href="/word/otta-lauss">óttalauss</Link> á <Link href="/word/himinn">himni</Link> eða <Link href="/word/jord">jǫrðu</Link>
. <Link href="/word/aesir">Æsir</Link> <Link href="/word/her-klaeda">herklæða</Link> <Link href="/word/sik">sik</Link> <Link href="/word/ok">ok</Link> <Link href="/word/allr">allir</Link> <Link href="/word/ein-herjar">Einherjar</Link> <Link href="/word/ok">ok</Link> <Link href="/word/saekja">sœkja</Link> <Link href="/word/fram">fram</Link> á <Link href="/word/vollr">vǫlluna</Link>
. <Link href="/word/rida-3">ríðr</Link> <Link href="/word/fyrsta">fyrstr</Link> <Link href="/word/odinn">Óðinn</Link> <Link href="/word/med">með</Link> <Link href="/word/gull-hjalmr">gullhjálm</Link> <Link href="/word/ok">ok</Link> <Link href="/word/fagr">fagra</Link> <Link href="/word/brynja-2">brynju</Link> <Link href="/word/ok">ok</Link> <Link href="/word/geirr">geir</Link> <Link href="/word/sinn">sinn</Link> <Link href="/word/er">er</Link> Gungnir <Link href="/word/heita-2">heitir</Link>. <Link href="/word/stefnir">Stefnir</Link> <Link href="/word/hann">hann</Link> <Link href="/word/mot">móti</Link> Fenris<Link href="/word/ulfr">úlf</Link>
, en Þórr <Link href="/word/fram">fram</Link> á aðra <Link href="/word/hlid">hlið</Link> <Link href="/word/hann">honum</Link>, <Link href="/word/ok">ok</Link> <Link href="/word/mega">má</Link> <Link href="/word/hann">hann</Link> <Link href="/word/ekki">ekki</Link> <Link href="/word/duga">duga</Link> <Link href="/word/hann">honum</Link>, <Link href="/word/thvi">því</Link> at <Link href="/word/hann">hann</Link> <Link href="/word/hafa">hefir</Link> <Link href="/word/full-2">fullt</Link> <Link href="/word/fang">fang</Link> at <Link href="/word/berja">berjask</Link> <Link href="/word/vid">við</Link> <Link href="/word/mid-gardr">Miðgarðs</Link>-<Link href="http://localhost:3000/word/ormr">orm</Link>.
En <Link href="/word/er" prefetch={false}>er</Link> <Link href="/word/thessi" prefetch={false}>þessi</Link> <Link href="/word/tidindi" prefetch={false}>tíðindi</Link> <Link href="/word/verda-2" prefetch={false}>verða</Link>, <Link href="/word/tha-2" prefetch={false}>þá</Link>
<Link href="/word/standa" prefetch={false}>stendr</Link> <Link href="/word/upp" prefetch={false}>upp</Link> Heimdallr <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/blasa-2" prefetch={false}>blæss</Link> <Link href="/word/a-kafliga" prefetch={false}>ákafliga</Link> í <Link href="/word/gjoll" prefetch={false}>Gjallar</Link><Link href="/word/horn" prefetch={false}>horn</Link> <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/vekja" prefetch={false}>vekr</Link> <Link href="/word/upp" prefetch={false}>upp</Link> <Link href="/word/allr" prefetch={false}>ǫll</Link> <Link href="/word/god" prefetch={false}>guðin</Link>, <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/eiga" prefetch={false}>eiga</Link> þau <Link href="/word/thing" prefetch={false}>þing</Link> <Link href="/word/saman" prefetch={false}>saman</Link>
. <Link href="/word/tha-2" prefetch={false}>þá</Link> <Link href="/word/rida-3" prefetch={false}>ríðr</Link> <Link href="/word/odinn" prefetch={false}>Óðinn</Link> <Link href="/word/til" prefetch={false}>til</Link> <Link href="/word/mimir" prefetch={false}>Mímisbrunns</Link> <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/taka" prefetch={false}>tekr</Link> <Link href="/word/rada" prefetch={false}>ráð</Link> <Link href="/word/af" prefetch={false}>af</Link> <Link href="/word/mimir" prefetch={false}>Mími</Link> <Link href="/word/fyrir" prefetch={false}>fyrir</Link> <Link href="/word/ser" prefetch={false}>sér</Link> <Link href="/word/ok" prefetch={false}>ok</Link> sínu <Link href="/word/lidi" prefetch={false}>liði</Link>
. <Link href="/word/tha-2" prefetch={false}>þá</Link> <Link href="/word/skelfr" prefetch={false}>skelfr</Link> <Link href="/word/askr" prefetch={false}>askr</Link> Yggdrasils, <Link href="/word/ok" prefetch={false}>ok</Link> engi <Link href="/word/hlutr" prefetch={false}>hlutr</Link> <Link href="/word/er" prefetch={false}>er</Link> <Link href="/word/tha-2" prefetch={false}>þá</Link> <Link href="/word/otta-lauss" prefetch={false}>óttalauss</Link> á <Link href="/word/himinn" prefetch={false}>himni</Link> eða <Link href="/word/jord" prefetch={false}>jǫrðu</Link>
. <Link href="/word/aesir" prefetch={false}>Æsir</Link> <Link href="/word/her-klaeda" prefetch={false}>herklæða</Link> <Link href="/word/sik" prefetch={false}>sik</Link> <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/allr" prefetch={false}>allir</Link> <Link href="/word/ein-herjar" prefetch={false}>Einherjar</Link> <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/saekja" prefetch={false}>sœkja</Link> <Link href="/word/fram" prefetch={false}>fram</Link> á <Link href="/word/vollr" prefetch={false}>vǫlluna</Link>
. <Link href="/word/rida-3" prefetch={false}>ríðr</Link> <Link href="/word/fyrsta" prefetch={false}>fyrstr</Link> <Link href="/word/odinn" prefetch={false}>Óðinn</Link> <Link href="/word/med" prefetch={false}>með</Link> <Link href="/word/gull-hjalmr" prefetch={false}>gullhjálm</Link> <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/fagr" prefetch={false}>fagra</Link> <Link href="/word/brynja-2" prefetch={false}>brynju</Link> <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/geirr" prefetch={false}>geir</Link> <Link href="/word/sinn" prefetch={false}>sinn</Link> <Link href="/word/er" prefetch={false}>er</Link> Gungnir <Link href="/word/heita-2" prefetch={false}>heitir</Link>. <Link href="/word/stefnir" prefetch={false}>Stefnir</Link> <Link href="/word/hann" prefetch={false}>hann</Link> <Link href="/word/mot" prefetch={false}>móti</Link> Fenris<Link href="/word/ulfr" prefetch={false}>úlf</Link>
, en Þórr <Link href="/word/fram" prefetch={false}>fram</Link> á aðra <Link href="/word/hlid" prefetch={false}>hlið</Link> <Link href="/word/hann" prefetch={false}>honum</Link>, <Link href="/word/ok" prefetch={false}>ok</Link> <Link href="/word/mega" prefetch={false}>má</Link> <Link href="/word/hann" prefetch={false}>hann</Link> <Link href="/word/ekki" prefetch={false}>ekki</Link> <Link href="/word/duga" prefetch={false}>duga</Link> <Link href="/word/hann" prefetch={false}>honum</Link>, <Link href="/word/thvi" prefetch={false}>því</Link> at <Link href="/word/hann" prefetch={false}>hann</Link> <Link href="/word/hafa" prefetch={false}>hefir</Link> <Link href="/word/full-2" prefetch={false}>fullt</Link> <Link href="/word/fang" prefetch={false}>fang</Link> at <Link href="/word/berja" prefetch={false}>berjask</Link> <Link href="/word/vid" prefetch={false}>við</Link> <Link href="/word/mid-gardr" prefetch={false}>Miðgarðs</Link>-<Link href="http://localhost:3000/word/ormr" prefetch={false}>orm</Link>.
</em>
</p>

Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchResults/SearchTeaser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function SearchTeaser({ data }: SearchTeaserProps) {

return (
<div className={styles.result}>
<Link key={`link${slug}`} href={`/word/${slug}`} className={styles.link}>
<Link key={`link${slug}`} href={`/word/${slug}`} className={styles.link} prefetch={false}>
{word.toLowerCase()}
</Link>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion src/components/WordLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function WordLink({ data, useLowerCase = true }: WordLinkProps) {
const { slug, word } = data

return (
<Link key={`link${slug}`} href={`/word/${slug}`} className={styles.link}>
<Link key={`link${slug}`} href={`/word/${slug}`} className={styles.link} prefetch={false}>
{useLowerCase ? word.toLowerCase() : word}
</Link>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function Index({ words, letters }: IndexProps) {
Containing over 35 000 entries with English definitions,
it is one of the most important resources for the norse language.</p>

<Link href="/search" className="button">
<Link href="/search" className="button" prefetch={false}>
Search the dictionary
</Link>
</ContentArea>
Expand Down

0 comments on commit f3ea77d

Please sign in to comment.