Skip to content

fix: render lazy charts already in viewport on page load#1287

Open
HardeepAsrani wants to merge 1 commit intodevelopmentfrom
fix/lady-load
Open

fix: render lazy charts already in viewport on page load#1287
HardeepAsrani wants to merge 1 commit intodevelopmentfrom
fix/lady-load

Conversation

@HardeepAsrani
Copy link
Member

Summary

The scroll listener for lazy charts never fired if the chart was already visible on page load, causing it to remain blank until the user scrolled. Extracted the logic into a named function with a viewport bounds check and call it once at page load in addition to on scroll.

Will affect visual aspect of the product

No

Screenshots

Test instructions

  • The charts should load when they come to viewport if lazy loading is enabled.
  • Previously, the charts which were in viewport when the page loaded weren't loading until the user scrolls. Make sure that isn't the case anymore.

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/visualizer-pro/issues/526.

The scroll listener for lazy charts never fired if the chart was already
visible on page load, causing it to remain blank until the user scrolled.
Extracted the logic into a named function with a viewport bounds check and
call it once at page load in addition to on scroll.
@HardeepAsrani HardeepAsrani requested a review from abaicus March 17, 2026 11:45
@HardeepAsrani HardeepAsrani added the pr-checklist-skip Allow this Pull Request to skip checklist. label Mar 17, 2026
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Mar 17, 2026
@pirate-bot
Copy link
Contributor

Plugin build for 4f8c2e1 is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants