fix(common): avoid redundant image fetch on destroy with auto sizes#67060
fix(common): avoid redundant image fetch on destroy with auto sizes#67060leonsenft merged 1 commit intoangular:mainfrom
Conversation
|
As mentionned in #67055, I think if we workaround around a chrome bug, we should at least reference a chrome bug reference. |
| }); | ||
| } | ||
|
|
||
| // Chromium may re-evaluate during DOM teardown when using `sizes="auto"` |
There was a problem hiding this comment.
We might want to update the phrasing to hint that this is more or less the expected behavior per the specs.
Maybe the other browsers will allign in the future.
Also I'm wondering if we can catch this behavior in a unit test with the onLoad event.
There was a problem hiding this comment.
Wdyt ?
// Browsers might re-evaluate the image during DOM teardown when using `sizes="auto"`
// with `loading="lazy"`, potentially triggering an unnecessary image fetch.
// This is expected behavior per the HTML spec
// See: https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
// See also: https://github.com/angular/angular/issues/67055#issuecomment-3898513831I tried to reproduce the problem in a unit test with the onload event, but it was not possible ( It never fires when the component is destroyed )
That might only be possible in an e2e test, but I think that would be too complex.
There was a problem hiding this comment.
Just to make sure we aren't missing anything, you tested this on the browser targets (not the node targets) ?
There was a problem hiding this comment.
I ran the entire test suite with pnpm test //packages/common/... and also made sure to try it directly with pnpm //packages/common/test:test_web_chromium.
However, I was unable to replicate it.
I manually verified the fix in Chrome.
prevents browsers from re-fetch image during DOM teardown when using `sizes="auto"` with lazy loading. Fixes angular#67055
0908cac to
6642711
Compare
JeanMeche
left a comment
There was a problem hiding this comment.
Thanks for the investigation and the information provided.
Prevents Chromium from re-fetch image during DOM teardown when using
sizes="auto"with lazy loading.See #67055 (comment)
Fixes #67055