Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit 443e1b9

Browse files
committed
fix: only calculate a new preview element when the 'value' changes
1 parent 1c323ef commit 443e1b9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/packages/media/media/components/input-upload-field/input-upload-field.element.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
7474

7575
constructor() {
7676
super();
77+
}
78+
79+
override updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>) {
80+
super.updated(changedProperties);
81+
if (changedProperties.has('value')) {
82+
this.#setPreviewAlias();
83+
}
84+
}
7785

7886
async #getManifests() {
7987
await new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'fileUploadPreview', null, (exts) => {
@@ -92,6 +100,10 @@ export class UmbInputUploadFieldElement extends UmbLitElement {
92100
this._extensions = extensions?.map((extension) => `.${extension}`);
93101
}
94102

103+
async #setPreviewAlias(): Promise<void> {
104+
this._previewAlias = await this.#getPreviewElementAlias();
105+
}
106+
95107
async #getPreviewElementAlias() {
96108
if (!this.value.src) return;
97109
const manifests = await this.#getManifests();

0 commit comments

Comments
 (0)