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 70baef5fa88ea..8889c4803c8de 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]);