Skip to content

Commit

Permalink
[frontend] fix duplicates in Bulk Search (#7214)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Jul 1, 2024
1 parent 3355b5f commit 31f7104
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,16 @@ const SearchBulk = () => {
);
if (resolvedStixCoreObjects.length > 0) {
return resolvedStixCoreObjects.map(
(resolvedStixCoreObject) => ({
id: resolvedStixCoreObject.id,
type: resolvedStixCoreObject.entity_type,
value: getMainRepresentative(resolvedStixCoreObject),
labels: resolvedStixCoreObject.objectLabel,
markings: resolvedStixCoreObject.objectMarking,
containersNumber: resolvedStixCoreObject.containersNumber,
updated_at: resolvedStixCoreObject.updated_at,
author: R.pathOr(
'',
['createdBy', 'name'],
resolvedStixCoreObject,
),
creators: (resolvedStixCoreObject.creators ?? [])
(object) => ({
id: object.id,
type: object.entity_type,
value: getMainRepresentative(object),
labels: object.objectLabel,
markings: object.objectMarking,
containersNumber: object.containersNumber,
updated_at: object.updated_at,
author: object.createdBy?.name ?? '',
creators: (object.creators ?? [])
.map((c) => c?.name)
.join(', '),
in_platform: true,
Expand All @@ -371,8 +367,9 @@ const SearchBulk = () => {
});
})
).flat();
const finalResult = R.uniqBy((o) => o.id, result);
setLoading(false);
setResolvedEntities(result);
setResolvedEntities(finalResult);
setPaginationOptions(searchPaginationOptions);
} else {
setResolvedEntities([]);
Expand Down

0 comments on commit 31f7104

Please sign in to comment.