From b59ed039c2a9a7ad5a52c2caf75cea7c0b0fd796 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Mon, 12 Jun 2023 00:13:36 +0200 Subject: [PATCH] catalog-react: clarify methods Signed-off-by: Vincenzo Scamporlino --- .../EntityOwnerPicker/EntityOwnerPicker.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx index 47e9689004..ed22e126c5 100644 --- a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx +++ b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx @@ -83,11 +83,10 @@ export const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => { queryParamOwners.length ? queryParamOwners : filters.owners?.values ?? [], ); - const [{ value, loading }, handleFetch, { getEntity, setEntity }] = - useFetchEntities({ - mode, - initialSelectedOwnersRefs: selectedOwners, - }); + const [{ value, loading }, handleFetch, cache] = useFetchEntities({ + mode, + initialSelectedOwnersRefs: selectedOwners, + }); useDebouncedEffect(() => handleFetch({ text }), [text, handleFetch], 250); const availableOwners = value?.items || []; @@ -136,7 +135,7 @@ export const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => { getOptionLabel={o => { const entity = typeof o === 'string' - ? getEntity(o) || + ? cache.getEntity(o) || parseEntityRef(o, { defaultKind: 'group', defaultNamespace: 'default', @@ -152,7 +151,7 @@ export const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => { typeof e === 'string' ? e : stringifyEntityRef(e); if (typeof e !== 'string') { - setEntity(e); + cache.setEntity(e); } return entityRef;