Skip to content

fix(common): avoid redundant image fetch on destroy with auto sizes#67060

Open
SkyZeroZx wants to merge 1 commit intoangular:mainfrom
SkyZeroZx:fix/img-directive-refetch
Open

fix(common): avoid redundant image fetch on destroy with auto sizes#67060
SkyZeroZx wants to merge 1 commit intoangular:mainfrom
SkyZeroZx:fix/img-directive-refetch

Conversation

@SkyZeroZx
Copy link
Contributor

Prevents Chromium from re-fetch image during DOM teardown when using sizes="auto" with lazy loading.

See #67055 (comment)

Fixes #67055

prevents Chromium from re-fetch image during DOM teardown
when using `sizes="auto"` with lazy loading.

Fixes angular#67055
@angular-robot angular-robot bot added the area: common Issues related to APIs in the @angular/common package label Feb 13, 2026
@ngbot ngbot bot added this to the Backlog milestone Feb 13, 2026
// with `loading="lazy"`, potentially triggering an unnecessary image fetch based
// See: https://github.com/angular/angular/issues/67055#issuecomment-3898513831
this.destroyRef.onDestroy(() => {
this.renderer.removeAttribute(this.imgElement, 'loading');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s fine to remove loading here, I validated in tests that we no longer hit the issue, and this shouldn’t affect any user behavior since it only impacts cleanup when the directive is destroyed

@SkyZeroZx SkyZeroZx marked this pull request as ready for review February 13, 2026 19:58
@pullapprove pullapprove bot requested a review from JeanMeche February 13, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: common Issues related to APIs in the @angular/common package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected 100vw image fetch when navigating away from components due to sizes="auto" in Chromium

1 participant