From d75976a23893297cf8cbd5f04de6794a006476a9 Mon Sep 17 00:00:00 2001 From: ByoungYong Kim Date: Thu, 27 Jun 2024 10:18:38 +0200 Subject: [PATCH] fix: Fix a bug when the same file is added on the single file input, the model value gets empty --- packages/ui/components/input-file/src/LionInputFile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/components/input-file/src/LionInputFile.js b/packages/ui/components/input-file/src/LionInputFile.js index d12ad032d..f9f67c08e 100644 --- a/packages/ui/components/input-file/src/LionInputFile.js +++ b/packages/ui/components/input-file/src/LionInputFile.js @@ -499,13 +499,13 @@ export class LionInputFile extends ScopedElementsMixin(LocalizeMixin(LionField)) this._inputNode.files = ev.dataTransfer.files; - const computedFiles = this.__computeNewAddedFiles( - /** @type {InputFile[]} */ (Array.from(ev.dataTransfer.files)), - ); if (this.multiple) { + const computedFiles = this.__computeNewAddedFiles( + /** @type {InputFile[]} */ (Array.from(ev.dataTransfer.files)), + ); this.modelValue = [...(this.modelValue ?? []), ...computedFiles]; } else { - this.modelValue = computedFiles; + this.modelValue = Array.from(ev.dataTransfer.files); } // @ts-ignore