#235·quicklink

Limit does not work if value is >= 4 *and* throttle property is set

Author: mherchelCreated May 22, 2021Updated Sep 17, 2026
Labelsbug

This was really hard to track down and is kinda weird, so bear with me.

If the following is true, the limit option is not respected

  • the limit option is greater or equal to 4
  • the throttle option is set

I posted a quick 1 minute video of this at https://youtu.be/hb5hBDZqTdY

To Reproduce Create the following HTML file, and then watch the network tab as all of the links are prefetched.

xml
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Prefetch: Basic Usage</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <script src="https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver"></script>
</head>

<body>

  <a href="link1">Lorem, ipsum.</a>
  <a href="link2">Eligendi, mollitia.</a>
  <a href="link3">Tempore, optio.</a>
  <a href="link4">Perspiciatis, modi!</a>
  <a href="link5">Voluptates, quas!</a>
  <a href="link6">Quibusdam, laborum.</a>
  <a href="link7">Veritatis, aspernatur?</a>
  <a href="link8">Obcaecati, totam!</a>
  <a href="link9">Repellat, ex.</a>
  <a href="link10">Laboriosam, explicabo.</a>
  <a href="link11">Saepe, harum.</a>
  <a href="link12">Aperiam, ad.</a>
  <a href="link13">Ut, quae!</a>
  <a href="link14">Et, sint.</a>
  <a href="link15">Facere, alias!</a>
  <a href="link16">Exercitationem, voluptatem.</a>
  <a href="link17">Sed, odio?</a>
  <a href="link18">Dicta, eum.</a>
  <a href="link19">Commodi, veniam.</a>
  <a href="link20">Quod, similique!</a>

  <script src="https://unpkg.com/[email protected]/dist/quicklink.umd.js"></script>
  <script>
    // Limit does not work if it is >=4 *and* throttle property is set.
    quicklink.listen({
      limit: 4,
      throttle: 3
    });
  </script>
</body>

</html>

Expected behavior I expect only 4 links to be prefetched

Version:

  • OS w/ version: MacOS 11.2.1 Big Sur
  • Browser w/ version: Version 90.0.4430.212 (Official Build) (x86_64)

Additional context, screenshots, screencasts

What's weird is that if the throttle option is not set, it works properly. Also, if the limit option is set to 3 or below, it will work properly even with the throttle option set.

Video showing the problem in action: https://youtu.be/hb5hBDZqTdY

Source: GoogleChromeLabs/quicklink