Skip to content

Commit

Permalink
Prevent infinite request loop with srcset in image. Closes #6332
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Dec 4, 2024
1 parent 0db6729 commit 2bd968e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/dom_components/view/ComponentImageView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ export default class ComponentImageView<TComp extends ComponentImage = Component
}

onError() {
const fallback = this.model.getSrcResult({ fallback: true });
const { model, el } = this;
const fallback = model.getSrcResult({ fallback: true });
if (fallback) {
this.el.src = fallback;
// Remove srcset to prevent error loop on src update #6332
if (el.srcset) el.srcset = '';
el.src = fallback;
}
}

Expand Down

0 comments on commit 2bd968e

Please sign in to comment.