mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-29 01:32:01 +00:00
ui: fixed re-render issue in glossary term page (#14051)
This commit is contained in:
parent
dc1d465b7e
commit
06d9ca3f49
@ -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 = ({
|
||||
<Col span={24}>
|
||||
<DescriptionV1
|
||||
description={glossaryDescription}
|
||||
entityName={selectedData?.displayName ?? selectedData?.name}
|
||||
entityName={getEntityName(selectedData)}
|
||||
entityType={EntityType.GLOSSARY}
|
||||
hasEditAccess={permissions.EditDescription || permissions.EditAll}
|
||||
isEdit={isDescriptionEditable}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
import { AxiosError } from 'axios';
|
||||
import { compare } from 'fast-json-patch';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useHistory, useParams } from 'react-router-dom';
|
||||
import ErrorPlaceHolder from '../../../components/common/ErrorWithPlaceholder/ErrorPlaceHolder';
|
||||
@ -248,28 +248,31 @@ const GlossaryPage = () => {
|
||||
.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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user