From 4694eb16e3dd831dfa36f483097d54f30a93f9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 20 May 2026 17:37:35 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20EntityKindPicker=20ref=20=E2=80=94=20p?= =?UTF-8?q?rovider=20dedup=20handles=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The label is read by CatalogTable for the table title (e.g. "All Components (42)"), so suppressing the label update would cause a visible regression. The provider's ref-based fetch dedup already prevents the redundant API call when only the label changes, so the second updateFilters call is harmless. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Fredrik Adelöw --- .../EntityKindPicker/EntityKindPicker.test.tsx | 2 +- .../src/components/EntityKindPicker/EntityKindPicker.tsx | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx index 7397c3ee1e..9fa8e6e097 100644 --- a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx @@ -140,7 +140,7 @@ describe('', () => { ); expect(updateFilters).toHaveBeenLastCalledWith({ - kind: new EntityKindFilter('group', 'group'), + kind: new EntityKindFilter('group', 'Group'), }); }); diff --git a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx index c0565851b0..534b8d03b3 100644 --- a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx +++ b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx @@ -17,7 +17,7 @@ import { Select } from '@backstage/core-components'; import { alertApiRef, useApi } from '@backstage/core-plugin-api'; import Box from '@material-ui/core/Box'; -import { useEffect, useMemo, useRef, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { EntityKindFilter } from '../../filters'; import { useEntityList } from '../../hooks'; import { filterKinds, useAllKinds } from './kindFilterUtils'; @@ -65,16 +65,13 @@ function useEntityKindFilter(opts: { initialFilter: string }): { const { allKinds, loading, error } = useAllKinds(); const selectedKindLabel = allKinds.get(selectedKind) || selectedKind; - const kindLabelRef = useRef(selectedKindLabel); - kindLabelRef.current = selectedKindLabel; - useEffect(() => { updateFilters({ kind: selectedKind - ? new EntityKindFilter(selectedKind, kindLabelRef.current) + ? new EntityKindFilter(selectedKind, selectedKindLabel) : undefined, }); - }, [selectedKind, updateFilters]); + }, [selectedKind, selectedKindLabel, updateFilters]); return { loading,