diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx index fe46c31462b..00453804852 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTerms/tabs/GlossaryOverviewTab.component.tsx @@ -18,6 +18,7 @@ import { Glossary } from '../../../../generated/entity/data/glossary'; import { GlossaryTerm } from '../../../../generated/entity/data/glossaryTerm'; import { ChangeDescription } from '../../../../generated/entity/type'; import { TagLabel } from '../../../../generated/type/tagLabel'; +import { getEntityName } from '../../../../utils/EntityUtils'; import { getEntityVersionByField, getEntityVersionTags, @@ -109,7 +110,7 @@ const GlossaryOverviewTab = ({ { .finally(() => setDeleteStatus(LOADING_STATE.INITIAL)); }; - const handleGlossaryTermUpdate = async (updatedData: GlossaryTerm) => { - const jsonPatch = compare(selectedData as GlossaryTerm, updatedData); - try { - const response = await patchGlossaryTerm( - selectedData?.id as string, - jsonPatch - ); - if (response) { - setSelectedData(response); - if (selectedData?.name !== updatedData.name) { - history.push(getGlossaryPath(response.fullyQualifiedName)); - fetchGlossaryList(); + const handleGlossaryTermUpdate = useCallback( + async (updatedData: GlossaryTerm) => { + const jsonPatch = compare(selectedData as GlossaryTerm, updatedData); + try { + const response = await patchGlossaryTerm( + selectedData?.id as string, + jsonPatch + ); + if (response) { + setSelectedData(response); + if (selectedData?.name !== updatedData.name) { + history.push(getGlossaryPath(response.fullyQualifiedName)); + fetchGlossaryList(); + } + } else { + throw t('server.entity-updating-error', { + entity: t('label.glossary-term'), + }); } - } else { - throw t('server.entity-updating-error', { - entity: t('label.glossary-term'), - }); + } catch (error) { + showErrorToast(error as AxiosError); } - } catch (error) { - showErrorToast(error as AxiosError); - } - }; + }, + [selectedData] + ); const handleGlossaryTermDelete = (id: string) => { setDeleteStatus(LOADING_STATE.WAITING);