Skip to content

Commit

Permalink
fix: can't show tag description in tag edit page (#664)
Browse files Browse the repository at this point in the history
fix #637 .
  • Loading branch information
hgaol authored and LinkinStars committed Dec 7, 2023
1 parent 088585e commit b72058d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ui/src/pages/Tags/Edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<FormDataItem>(initFormData);
const [immData, setImmData] = useState(initFormData);
const [contentChanged, setContentChanged] = useState(false);
Expand All @@ -85,16 +82,21 @@ 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 {
displayName: display_name,
slugName: slug_name,
description: original_text,
} = immData;
if (!display_name || !slug_name || !original_text) {
return;
}

if (
display_name.value !== displayName.value ||
Expand Down

0 comments on commit b72058d

Please sign in to comment.