From b72058d1f60af5c9bac81e219245909b916720c5 Mon Sep 17 00:00:00 2001 From: Han Gao Date: Thu, 30 Nov 2023 14:42:09 +0800 Subject: [PATCH] fix: can't show tag description in tag edit page (#664) fix #637 . --- ui/src/pages/Tags/Edit/index.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/src/pages/Tags/Edit/index.tsx b/ui/src/pages/Tags/Edit/index.tsx index c1f514870..c737353c2 100644 --- a/ui/src/pages/Tags/Edit/index.tsx +++ b/ui/src/pages/Tags/Edit/index.tsx @@ -70,9 +70,6 @@ const Index = () => { const { data } = useTagInfo({ id: tagId }); const { data: revisions = [] } = useQueryRevisions(data?.tag_id); - initFormData.displayName.value = data?.display_name || ''; - initFormData.slugName.value = data?.slug_name || ''; - initFormData.description.value = data?.original_text || ''; const [formData, setFormData] = useState(initFormData); const [immData, setImmData] = useState(initFormData); const [contentChanged, setContentChanged] = useState(false); @@ -85,6 +82,14 @@ const Index = () => { when: contentChanged, }); + useEffect(() => { + initFormData.displayName.value = data?.display_name || ''; + initFormData.slugName.value = data?.slug_name || ''; + initFormData.description.value = data?.original_text || ''; + setFormData(initFormData); + setImmData(initFormData); + }, [data]); + useEffect(() => { const { displayName, slugName, description, editSummary } = formData; const { @@ -92,9 +97,6 @@ const Index = () => { slugName: slug_name, description: original_text, } = immData; - if (!display_name || !slug_name || !original_text) { - return; - } if ( display_name.value !== displayName.value ||