catalog-react: improve comment

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-06-15 19:34:51 +02:00
parent a996c54f68
commit 633358a05b
2 changed files with 10 additions and 5 deletions
@@ -29,9 +29,10 @@ export function useOwnedEntitiesCount() {
const catalogApi = useApi(catalogApiRef);
const { filters } = useEntityList();
// Trigger load only on mount
const { value: ownershipEntityRefs, loading: loadingEntityRefs } = useAsync(
async () => (await identityApi.getBackstageIdentity()).ownershipEntityRefs,
// load only on mount
[],
);
@@ -41,10 +41,14 @@ export function useEntityOwnership(): {
const identityApi = useApi(identityApiRef);
// Trigger load only on mount
const { loading, value: refs } = useAsync(async () => {
const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();
return ownershipEntityRefs;
}, []);
const { loading, value: refs } = useAsync(
async () => {
const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();
return ownershipEntityRefs;
},
// load only on mount
[],
);
const isOwnedEntity = useMemo(() => {
const myOwnerRefs = new Set(refs ?? []);