Revert EntityKindPicker ref — provider dedup handles it

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) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-05-20 17:37:35 +02:00
parent 7c205457b6
commit 4694eb16e3
2 changed files with 4 additions and 7 deletions
@@ -140,7 +140,7 @@ describe('<EntityKindPicker/>', () => {
);
expect(updateFilters).toHaveBeenLastCalledWith({
kind: new EntityKindFilter('group', 'group'),
kind: new EntityKindFilter('group', 'Group'),
});
});
@@ -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,