Browse Source
Prevent infinite request loop with srcset in image (#6341)
Prevent infinite request loop with srcset in image. Closes #6332
pull/6342/head
Artur Arseniev
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
2 deletions
-
packages/core/src/dom_components/view/ComponentImageView.ts
|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|