Browse Source

refactor: trigger record update only if at least one file uploads

pull/9697/head
Pranav C 1 month ago
parent
commit
79846c555a
  1. 4
      packages/nc-gui/components/cell/attachment/utils.ts

4
packages/nc-gui/components/cell/attachment/utils.ts

@ -219,7 +219,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
return updateModelValue(attachments.value) return updateModelValue(attachments.value)
} }
if (selectedFiles.length) { if (files.length) {
try { try {
const data = await api.storage.upload( const data = await api.storage.upload(
{ {
@ -248,7 +248,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
if (!data) return if (!data) return
newAttachments.push(...data) 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) { async function uploadViaUrl(url: AttachmentReqType | AttachmentReqType[], returnError = false) {

Loading…
Cancel
Save