-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: can't show tag description in tag edit page #664
Conversation
ui/src/pages/Tags/Edit/index.tsx
Outdated
...formData.description, | ||
value: data?.original_text || '', | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may have overlooked immData. immData is used to record the initial value. When the user changes the content and leaves the page, there will be a prompt; therefore, you need to add an assignment operation to immData here;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shuashuai , updated. There's one thing makes me confused that for below codes.
useEffect(() => {
....
if (!display_name || !slug_name || !original_text) {
return;
}
....
}
Seems it'll never go into this condition branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shuashuai , updated. There's one thing makes me confused that for below codes.
useEffect(() => { .... if (!display_name || !slug_name || !original_text) { return; } .... }
Seems it'll never go into this condition branch.
Yes, you can remove this condition now! In addition, for the previous assignment operation, you can simplify the code and use an object to assign the value. Try to reduce the number of lines of code! Thank you for your thoughts and suggestions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved. please help to review and let me know if any comment. thanks!
fix #637 .