From b0005c216b116106ec1c20f9cf07869f4c68a956 Mon Sep 17 00:00:00 2001 From: Vito Date: Thu, 18 Mar 2021 09:28:59 +0000 Subject: [PATCH] [ADF-5358] - fixed duplicated type on reopening viewer (#6815) --- .../services/content-type-property.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/content-services/src/lib/content-metadata/services/content-type-property.service.ts b/lib/content-services/src/lib/content-metadata/services/content-type-property.service.ts index c273d89bdf..6b6e471064 100644 --- a/lib/content-services/src/lib/content-metadata/services/content-type-property.service.ts +++ b/lib/content-services/src/lib/content-metadata/services/content-type-property.service.ts @@ -66,8 +66,9 @@ export class ContentTypePropertiesService { } private appendCurrentType(currentType: TypeEntry, contentTypesEntries: TypeEntry[]): TypeEntry[] { - const resultTypes = contentTypesEntries; - if (contentTypesEntries.indexOf(currentType) === -1) { + const resultTypes = [...contentTypesEntries]; + const currentTypePresent = contentTypesEntries.find((type) => type.entry.id === currentType.entry.id); + if (!currentTypePresent) { resultTypes.push(currentType); } return resultTypes;