From ac6608236c92ff32e7b3b6355f8836053110f5e8 Mon Sep 17 00:00:00 2001 From: Philippe Oberti Date: Mon, 6 Jan 2025 18:51:47 +0100 Subject: [PATCH] [8.17] [Security Solution] - fixing infinite look on host flyout panel due to lack of memoization (#204999) (#205624) # Backport This will backport the following commits from `main` to `8.17`: - [[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) \n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n\n\nCo-authored-by: Philippe Oberti "}}]}] BACKPORT--> --- .../alerts_by_status/use_alerts_by_status.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts b/x-pack/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts index e80f3ec0a0caf..9af905cab8580 100644 --- a/x-pack/plugins/security_solution/public/overview/components/detection_response/alerts_by_status/use_alerts_by_status.ts +++ b/x-pack/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,