From 63d9b3ac2e754a0b13e053aa7879deeaf7fad9f8 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Fri, 26 May 2023 10:07:11 -0500 Subject: [PATCH] fix library annotation loading --- .../editor_frame/state_helpers.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts index 826c5e4c5ea7e..5731160edc63d 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts @@ -186,16 +186,15 @@ const initializeEventAnnotationGroups = async ( ) => { const annotationGroups: Record = {}; - const annotationGroupResponses = await Promise.allSettled( + await Promise.allSettled( (references || []) .filter((ref) => ref.type === EVENT_ANNOTATION_GROUP_TYPE) - .map(({ id }) => eventAnnotationService.loadAnnotationGroup(id)) + .map(({ id }) => + eventAnnotationService.loadAnnotationGroup(id).then((group) => { + annotationGroups[id] = group; + }) + ) ); - for (const response of annotationGroupResponses) { - if (response.status === 'fulfilled') { - annotationGroups[response.value.id] = response.value; - } - } return annotationGroups; };