From 6d2f17b2cb12270ef970ae6feff1781c6d94d1b5 Mon Sep 17 00:00:00 2001
From: Andrey Sobolev <haiodo@users.noreply.github.com>
Date: Tue, 16 Jul 2024 12:07:27 +0700
Subject: [PATCH] QFix for duplicate undefined in list (#6068)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
---
 plugins/contact-resources/src/utils.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plugins/contact-resources/src/utils.ts b/plugins/contact-resources/src/utils.ts
index 647d727047..d4b4a280fe 100644
--- a/plugins/contact-resources/src/utils.ts
+++ b/plugins/contact-resources/src/utils.ts
@@ -481,7 +481,12 @@ export function groupByPersonAccountCategories (categories: any[]): AggregateVal
           .map((it) => new AggregateValueData(it.person, it._id, it.space))
         fst = new AggregateValue(personAccount.person, people)
         personMap.set(personAccount.person, fst)
-        existingCategories.push(fst)
+        if (fst.name === undefined) {
+          existingCategories[0] = new AggregateValue(undefined, [...existingCategories[0].values, ...fst.values])
+          // Join with first value
+        } else {
+          existingCategories.push(fst)
+        }
       }
     }
   }