From 3d88e86b0787aa3faaa8c2bffd04b31d53d0008f Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 24 Dec 2024 04:44:46 +1100 Subject: [PATCH] [8.x] [Security Solution] - fixing infinite look on host flyout panel due to lack of memoization (#204999) (#205104) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution] - fixing infinite look on host flyout panel due to lack of memoization (#204999)](https://github.com/elastic/kibana/pull/204999) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Philippe Oberti --- .../alerts_by_status/use_alerts_by_status.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts b/x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts index e80f3ec0a0caf..9af905cab8580 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useCallback, useEffect, useState } from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; import type { Severity } from '@kbn/securitysolution-io-ts-alerting-types'; import { useDispatch } from 'react-redux'; @@ -200,12 +200,17 @@ export const useAlertsByStatus: UseAlertsByStatus = ({ } }, [skip, refetchQuery]); - useQueryInspector({ - deleteQuery, - inspect: { + const inspect = useMemo( + () => ({ dsl: [request], response: [response], - }, + }), + [request, response] + ); + + useQueryInspector({ + deleteQuery, + inspect, refetch, setQuery, queryId,