diff --git a/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts b/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts index 21bf70aebc75b..3c342ae575aa0 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts +++ b/x-pack/plugins/security_solution/public/resolver/view/use_resolver_query_params.ts @@ -51,9 +51,15 @@ export function useResolverQueryParams() { const parsed = querystring.parse(urlSearch.slice(1)); const crumbEvent = parsed[uniqueCrumbEventKey]; const crumbId = parsed[uniqueCrumbIdKey]; + function valueForParam(param: string | string[]): string { + if (Array.isArray(param)) { + return param[0] || ''; + } + return param || ''; + } return { - crumbEvent: Array.isArray(crumbEvent) ? crumbEvent[0] : crumbEvent, - crumbId: Array.isArray(crumbId) ? crumbId[0] : crumbId, + crumbEvent: valueForParam(crumbEvent), + crumbId: valueForParam(crumbId), }; }, [urlSearch, uniqueCrumbIdKey, uniqueCrumbEventKey]);