Do not store empty arrays

This commit is contained in:
Adria Navarro 2024-04-25 13:20:00 +02:00
parent 35ba5b93b5
commit b7688d3a06
1 changed files with 5 additions and 1 deletions

View File

@ -82,11 +82,15 @@ export async function processInputBBReferences<
throw new InvalidBBRefError(notFoundIds[0], FieldSubtype.USER) throw new InvalidBBRefError(notFoundIds[0], FieldSubtype.USER)
} }
if (!referenceIds?.length) {
return null
}
if (subtype === FieldSubtype.USERS) { if (subtype === FieldSubtype.USERS) {
return referenceIds return referenceIds
} }
return referenceIds.join(",") || null return referenceIds.join(",")
} }
default: default:
throw utils.unreachable(subtype) throw utils.unreachable(subtype)