From 977a106e3e35c2d73f7b3310d5c2953ccc192e37 Mon Sep 17 00:00:00 2001 From: Miki Date: Tue, 3 Oct 2023 14:08:12 -0700 Subject: [PATCH] Fix vis-augmenter forming empty key-value pairs in its calls to the savedObject API Fixes #5187 Signed-off-by: Miki --- src/plugins/vis_augmenter/public/utils/utils.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/vis_augmenter/public/utils/utils.ts b/src/plugins/vis_augmenter/public/utils/utils.ts index f1c18ce15b79..c8ebde337757 100644 --- a/src/plugins/vis_augmenter/public/utils/utils.ts +++ b/src/plugins/vis_augmenter/public/utils/utils.ts @@ -72,19 +72,19 @@ export const getAugmentVisSavedObjs = async ( ); } try { - // If there is specified plugin resource IDs, add a search string and search field - // into findAll() fn call + // If there are any plugin resource IDs specified, add a search string and search field + // into findAll() call const pluginResourceIdsSpecified = - pluginResourceIds !== undefined && pluginResourceIds.length > 0; + Array.isArray(pluginResourceIds) && pluginResourceIds.length > 0; const resp = await loader?.findAll( - pluginResourceIdsSpecified ? pluginResourceIds.join('|') : '', + pluginResourceIdsSpecified ? pluginResourceIds!.join('|') : '', 100, - [], + undefined, { type: 'visualization', id: visId as string, }, - pluginResourceIdsSpecified ? ['pluginResource.id'] : [] + pluginResourceIdsSpecified ? ['pluginResource.id'] : undefined ); return (get(resp, 'hits', []) as any[]) as ISavedAugmentVis[]; } catch (e) {