Add a lazy link preloader to warm Turbo and Drupal caches while scrolling

Created on 22 June 2025, about 2 months ago

Problem/Motivation

Now that 📌 Turbo: Re-enable Turbo cache once we can reliably detach before is cached Active seems to be working, we start considering more advanced uses of caching to make pages load instantly even when you haven't visited them yet. Turbo supports preloading links into its cache, and we could create an optional lazy preloader that preloads links when they scroll into the viewport. This would be similar to in a way to Turbo's prefetch on hover, but using Turbo's cache which allows for more than one link to be shown instantly without a time limit, and would work on mobile where Turbo doesn't do prefetching.

Steps to reproduce

Unvisited links still have to wait for the network, especially on mobile, when clicked.

Proposed resolution

See Omnipedia issue #64 for more details and proposed implementation.

Remaining tasks

See previous section link.

User interface changes

By default, no change, but if opted into by part of a page, links should appear to load instantly even on mobile.

API changes

Probably just adding one or two data-refreshless-* attributes to opt in and configure the lazy preloader.

Data model changes

None.

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada ambient.impact Toronto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024