WDscholia / scholia

Wikidata-based scholarly profiles
https://scholia.toolforge.org
Other
219 stars 78 forks source link

Add lazy loading for iframe content in sparqlToIframe function #2428

Closed faresh9 closed 6 months ago

faresh9 commented 7 months ago

Fixes #1652 Pr which seems lazy loading not working and causing memory problems.

Description

Enhances the sparqlToIframe function by implementing lazy loading for iframe content. The function now utilizes Intersection Observer to defer the loading of iframe content until it enters the viewport, improving page load performance by only loading content when it becomes visible to the user. The URL for the iframe content is stored in a data-src attribute, and the src attribute is set dynamically when the iframe enters the viewport.

Caveats

No caveats.

Testing

Tested some of #615 with google lighthouse and saw performance improvements and better memory usage.

Checklist