fix: make eager prop work again for Image and skip lazy load if prop isEager#679
fix: make eager prop work again for Image and skip lazy load if prop isEager#679Giov7 wants to merge 2 commits intovtex-apps:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR ensures that images explicitly marked for eager loading are not overridden by the render-runtime’s lazy-loading behavior, so the Image block’s eager-loading configuration works as intended.
Changes:
- Introduces an
isEagercheck inMaybeLazyImagebased onimageProps.loading === 'eager'. - Skips applying both native lazy-loading (
loading="lazy") and thelazysizeslogic when the image is eager, while preserving the existing preload (data-vtex-preload) behavior.
vmourac-vtex
left a comment
There was a problem hiding this comment.
Hi @Giov7 thanks for submitting your PR!
Your change makes sense and seems in line with loading behavior in components like ProductImage, InfoCard, etc.
@iago1501 @vsseixaso what do you think?
Regardless, I would ask you to:
- Modify the
CHANGELOGfile with your proposed change - Add tests to validate your changes
|
@Giov7 team agreed that this modification is ok to be merged. So as soon as you update the branch with the required changes we can proceed with merge/deploy
|
|
Hi @vmourac-vtex, I updated the CHANGELOG as requested. The tests done can be seen in https://www.whirlpool.it/?workspace=testkg65 where I linked my fork and noticed the behavior of Image component was correct when choosing between lazy and eager loading. |
This PR fixes a problem on the Image block which doesn't allow eager loading. That's happening because of vtex render runtime non-handling the image prop correctly.
How to test it? *
I tested this behaviour here: https://www.whirlpool.it/?workspace=testkg65