From 0c1dea05af2dfdd0ebac094032873c4a6838a473 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:25:58 +0200 Subject: [PATCH] [8.15] [Search] Stop rerendering connector pages unnecessarily (#189103) (#189179) # Backport This will backport the following commits from `main` to `8.15`: - [[Search] Stop rerendering connector pages unnecessarily (#189103)](https://github.com/elastic/kibana/pull/189103) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Sander Philipse <94373878+sphilipse@users.noreply.github.com> --- .../components/connector_detail/connector_detail.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/connector_detail.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/connector_detail.tsx index 955a8b79f60dc..62e209d2a5f14 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/connector_detail.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/connector_detail.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useEffect } from 'react'; +import React, { useEffect, useMemo } from 'react'; import { useParams } from 'react-router-dom'; import { useActions, useValues } from 'kea'; @@ -236,7 +236,7 @@ export const ConnectorDetail: React.FC = () => { ...CONFIG_TAB, ]; - const selectedTab = tabs.find((tab) => tab.id === tabId); + const selectedTab = useMemo(() => tabs.find((tab) => tab.id === tabId), [tabId]); return (