Skip to content
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: 修复刷新之后 label 丢失的情况 #8982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/field/src/components/Select/SearchSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ const SearchSelect = <T,>(props: SearchSelectProps<T[]>, ref: any) => {
const changedValue = value
? {
...value,
label: preserveOriginalLabel ? dataItem?.label : value.label,
// 这里有一种情况,如果用户使用了 request和labelInValue,保存之后,刷新页面,正常回显,但是再次添加会出现 label 丢失的情况。所以需要兼容
label: preserveOriginalLabel
? dataItem?.label || value.label
: value.label,
Comment on lines -299 to +302
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释部分应该贴一个 issue 地址,或者复现地址,不熟悉的人 review 可能想象不到这个 case

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

}
: value;
onChange?.(changedValue, optionList, ...rest);
Expand Down
Loading