diff --git a/x-pack/plugins/saved_objects_tagging/public/management/tag_management_page.tsx b/x-pack/plugins/saved_objects_tagging/public/management/tag_management_page.tsx index 551c5e9629f6f..6b0e17a945c06 100644 --- a/x-pack/plugins/saved_objects_tagging/public/management/tag_management_page.tsx +++ b/x-pack/plugins/saved_objects_tagging/public/management/tag_management_page.tsx @@ -163,8 +163,6 @@ export const TagManagementPage: FC = ({ if (confirmed) { await tagClient.delete(tag.id); - fetchTags(); - notifications.toasts.addSuccess({ title: i18n.translate('xpack.savedObjectsTagging.notifications.deleteTagSuccessTitle', { defaultMessage: 'Deleted "{name}" tag', @@ -173,6 +171,8 @@ export const TagManagementPage: FC = ({ }, }), }); + + await fetchTags(); } }, [overlays, notifications, fetchTags, tagClient] @@ -182,17 +182,18 @@ export const TagManagementPage: FC = ({ async (action: TagBulkAction) => { try { await action.execute(selectedTags.map(({ id }) => id)); - if (action.refreshAfterExecute) { - await fetchTags(); - } } catch (e) { notifications.toasts.addError(e, { title: i18n.translate('xpack.savedObjectsTagging.notifications.bulkActionError', { defaultMessage: 'An error occurred', }), }); + } finally { + setLoading(false); + } + if (action.refreshAfterExecute) { + await fetchTags(); } - setLoading(false); }, [selectedTags, fetchTags, notifications] );