fix(stabilization): fix loadImageSrcset plugin#264
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes the loadImageSrcset plugin by replacing a flawed "largest image selection" approach with a proper "force browser re-evaluation" strategy. The previous implementation attempted to manually parse srcset and always select the largest image, which didn't respect viewport sizes. The new implementation preserves the original srcset/sizes attributes and forces the browser to re-evaluate image selection on viewport changes by temporarily clearing and restoring these attributes.
Changes:
- Replaced srcset parsing logic with a re-evaluation approach that clears and restores srcset/sizes attributes
- Added storage of original srcset/sizes values in dataset attributes to preserve them across viewport changes
- Removed manual srcset parsing that selected the largest image regardless of viewport
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
9d017c9 to
b2afce1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
packages/browser/src/global/stabilization/plugins/loadImageSrcset.ts
Outdated
Show resolved
Hide resolved
- Fix handling of srcset with density - Fix image loading waiting - Fix round size backup
f10807c to
a596275
Compare
No description provided.