Browse Source

fix(nc-gui): ts error, object is possibly 'undefined'

pull/7491/head
Ramesh Mane 10 months ago
parent
commit
6bc9c473bb
  1. 8
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts

8
packages/nc-gui/composables/useMultiSelect/convertCellData.ts

@ -9,7 +9,7 @@ export default function convertCellData(
isMysql = false, isMysql = false,
isMultiple = false, isMultiple = false,
) { ) {
const { to, value, files, oldFiles, column } = args const { to, value, files = [], oldFiles, column } = args
const dateFormat = isMysql ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ' const dateFormat = isMysql ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ'
@ -116,7 +116,7 @@ export default function convertCellData(
const parsedOldFiles = parseProp(oldFiles) const parsedOldFiles = parseProp(oldFiles)
const oldAttachments = parsedOldFiles && Array.isArray(parsedOldFiles) ? parsedOldFiles : [] const oldAttachments = parsedOldFiles && Array.isArray(parsedOldFiles) ? parsedOldFiles : []
if (!value && !files) { if (!value && !files.length) {
if (oldAttachments.length) return undefined if (oldAttachments.length) return undefined
return null return null
} }
@ -157,7 +157,7 @@ export default function convertCellData(
const attachments = [] const attachments = []
for (const attachment of value ? parsedVal : files!) { for (const attachment of value ? parsedVal : files) {
if (args.appInfo.ee) { if (args.appInfo.ee) {
// verify number of files // verify number of files
if (parsedVal.length > attachmentMeta.maxNumberOfAttachments) { if (parsedVal.length > attachmentMeta.maxNumberOfAttachments) {
@ -202,7 +202,7 @@ export default function convertCellData(
return undefined return undefined
} else if (value && attachments.length) { } else if (value && attachments.length) {
return JSON.stringify([...oldAttachments, ...attachments]) return JSON.stringify([...oldAttachments, ...attachments])
} else if (files && attachments.length) { } else if (files.length && attachments.length) {
return attachments return attachments
} else { } else {
return null return null

Loading…
Cancel
Save