Fix value.every is not a function (#10213)

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko
2025-11-17 12:39:34 +07:00
committed by GitHub
parent 02fa0f4419
commit a8a4b90d4e
@@ -256,8 +256,12 @@ async function getValueCollaborators (value: any, attr: AnyAttribute, control: T
if (arrOf._class === core.class.RefTo) {
const to = (arrOf as RefTo<Doc>).to
if (hierarchy.isDerived(to, contact.class.Person)) {
if (!Array.isArray(value)) {
control.ctx.error('Expected array but got non-array value when getting value collaborators', { attr, value })
return []
}
if (value.length === 0) return []
if ((value as any[]).every((it) => it === null)) {
if (value.every((it) => it === null)) {
control.ctx.error('Null-values array of person refs when getting value collaborators', { attr, value })
}