Skip to content

Commit

Permalink
fix: update sources to prevent duplicate downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Feb 18, 2024
1 parent e98f7eb commit f055a46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/lazyLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ export function loadImage(
else if (image.sizes) {
imagePreLoader.sizes = image.sizes
}

// Update sources to prevent duplicate downloads
updatePictureSources(image)

if (srcset)
imagePreLoader.srcset = srcset
if (src)
imagePreLoader.src = src

imagePreLoader.addEventListener('load', () => {
updatePictureSources(image)
updateImageSrcset(image)
updateImageSrc(image)
onImageLoad?.(image)
Expand Down

0 comments on commit f055a46

Please sign in to comment.