Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: Lazy Load JS fails to initialize under high latency / VPN connections #202

Description

@DmitryBychenko

Description

When the Lazy Load feature is enabled in Powered Cache (v3.7.x), images are correctly replaced with the inline base64 GIF placeholder (src="data:image/gif;base64...") and assigned the lazy-hidden class.

However, under specific network conditions—specifically when accessing the site via a VPN (freevpn.one from USA) or from regions with higher network latency (e.g., cross-atlantic routing)—the JavaScript execution chain responsible for swapping the data-lazy-src attribute into the src attribute fails to trigger or complete.

As a result, the images permanently remain as empty boxes (stuck with the lazy-hidden class), even though no console errors are generated by the plugin's script itself. Disabling the Lazy Load feature in Powered Cache settings instantly resolves the problem.

Steps to reproduce

  1. Enable Lazy Load in Powered Cache settings (Media Optimization).
  2. Clear all cache levels.
  3. Access the website using a VPN from a distant location using a clean Incognito browser session.
  4. Observe that images fail to render, remaining stuck as base64 placeholders.

Suggested investigation / Fix

It seems to be a race condition related to how the lazy load script hooks into the DOM lifecycle (DOMContentLoaded or window.load events). When latency is high, the initialization script seemingly "misses" its execution window or fails to bind scroll/intersection listeners to elements that are already present in the DOM.

Please consider wrapping the lazyload initialization code with a fallback check for document.readyState === 'complete'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions