From 863e7bcb7bb3625f373296d3f60a1c51ba202e11 Mon Sep 17 00:00:00 2001 From: Joe Porpeglia Date: Wed, 6 Apr 2022 15:42:45 -0400 Subject: [PATCH] Remove explicit entity deletion from UnregisterEntityDialog Signed-off-by: Joe Porpeglia --- .changeset/proud-teachers-draw.md | 5 +++++ .../useUnregisterEntityDialogState.ts | 13 ++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 .changeset/proud-teachers-draw.md diff --git a/.changeset/proud-teachers-draw.md b/.changeset/proud-teachers-draw.md new file mode 100644 index 0000000000..dbce78c3c2 --- /dev/null +++ b/.changeset/proud-teachers-draw.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Updated the "unregister location" behavior in `UnregisterEntityDialog`. Removed unnecessary entity deletion requests that were sent after successfully deleting a location. diff --git a/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.ts b/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.ts index c14b6523c0..28e4863e8a 100644 --- a/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.ts +++ b/plugins/catalog-react/src/components/UnregisterEntityDialog/useUnregisterEntityDialogState.ts @@ -95,18 +95,13 @@ export function useUnregisterEntityDialogState( ); }, [catalogApi, entity]); - // Unregisters the underlying location and removes all of the entities that - // are spawned from it. Can only ever be called when the prerequisites have - // finished loading successfully, and if there was a matching location. + // Unregisters the underlying location which will remove all of the entities that are spawned from + // it. Can only ever be called when the prerequisites have finished loading successfully, and if + // there was a matching location. const unregisterLocation = useCallback( async function unregisterLocationFn() { - const { location, colocatedEntities } = prerequisites.value!; + const { location } = prerequisites.value!; await catalogApi.removeLocationById(location!.id); - await Promise.allSettled( - colocatedEntities.map(e => - catalogApi.removeEntityByUid(e.metadata.uid!), - ), - ); }, [catalogApi, prerequisites], );