diff --git a/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx b/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx index 5b303f75e2985..9c8e7624d1c74 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx @@ -34,6 +34,7 @@ function AddRelatedTermsModal(props: Props) { const [AddRelatedTerms] = useAddRelatedTermsMutation(); function addTerms() { + message.loading({ content: 'Adding...' }); AddRelatedTerms({ variables: { input: { @@ -43,19 +44,19 @@ function AddRelatedTermsModal(props: Props) { }, }, }) - .catch((e) => { - message.destroy(); - message.error({ content: `Failed to move: \n ${e.message || ''}`, duration: 3 }); - }) - .finally(() => { - message.loading({ content: 'Adding...', duration: 2 }); + .then(() => { setTimeout(() => { + refetch(); + message.destroy(); message.success({ content: 'Added Related Terms!', duration: 2, }); - refetch(); }, 2000); + }) + .catch((e) => { + message.destroy(); + message.error({ content: `Failed to move: \n ${e.message || ''}`, duration: 3 }); }); onClose(); } diff --git a/datahub-web-react/src/app/entity/glossaryTerm/profile/useRemoveRelatedTerms.tsx b/datahub-web-react/src/app/entity/glossaryTerm/profile/useRemoveRelatedTerms.tsx index 0eb46924243cd..aff9fa8dd79ec 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/profile/useRemoveRelatedTerms.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/profile/useRemoveRelatedTerms.tsx @@ -12,6 +12,9 @@ function useRemoveRelatedTerms(termUrn: string, relationshipType: TermRelationsh const [removeRelatedTerms] = useRemoveRelatedTermsMutation(); function handleRemoveRelatedTerms() { + message.loading({ + content: 'Removing...', + }); removeRelatedTerms({ variables: { input: { @@ -21,22 +24,19 @@ function useRemoveRelatedTerms(termUrn: string, relationshipType: TermRelationsh }, }, }) - .catch((e) => { - message.destroy(); - message.error({ content: `Failed to remove: \n ${e.message || ''}`, duration: 3 }); - }) - .finally(() => { - message.loading({ - content: 'Removing...', - duration: 2, - }); + .then(() => { setTimeout(() => { refetch(); + message.destroy(); message.success({ content: `Removed Glossary Term!`, duration: 2, }); }, 2000); + }) + .catch((e) => { + message.destroy(); + message.error({ content: `Failed to remove: \n ${e.message || ''}`, duration: 3 }); }); }