From 79846c555a56fadb0c3bd56d9315eb62134e8065 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 22 Oct 2024 07:59:21 +0000 Subject: [PATCH] refactor: trigger record update only if at least one file uploads --- packages/nc-gui/components/cell/attachment/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/cell/attachment/utils.ts b/packages/nc-gui/components/cell/attachment/utils.ts index 31bd735a48..e6e4f6c90c 100644 --- a/packages/nc-gui/components/cell/attachment/utils.ts +++ b/packages/nc-gui/components/cell/attachment/utils.ts @@ -219,7 +219,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( return updateModelValue(attachments.value) } - if (selectedFiles.length) { + if (files.length) { try { const data = await api.storage.upload( { @@ -248,7 +248,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( if (!data) return newAttachments.push(...data) } - updateModelValue(JSON.stringify([...attachments.value, ...newAttachments])) + if (newAttachments?.length) updateModelValue(JSON.stringify([...attachments.value, ...newAttachments])) } async function uploadViaUrl(url: AttachmentReqType | AttachmentReqType[], returnError = false) {