-
-
Notifications
You must be signed in to change notification settings - Fork 456
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: incorrect display when value change from with label to without label #1029
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1029 +/- ##
==========================================
- Coverage 99.78% 99.78% -0.01%
==========================================
Files 38 38
Lines 1398 1395 -3
Branches 418 391 -27
==========================================
- Hits 1395 1392 -3
Misses 3 3 ☔ View full report in Codecov by Sentry. |
00cca92
to
cb8a623
Compare
// Fill label by cache | ||
const patchedValues = labeledValues.map((item) => { | ||
if (item.label === undefined) { | ||
return { | ||
...item, | ||
label: prevValueCache.get(item.value)?.label, | ||
label: prevOptionCache.get(item.value)?.label, |
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.
*/ | ||
export default ( | ||
labeledValues: LabelInValueType[], | ||
valueOptions: Map<RawValueType, DefaultOptionType>, | ||
): [LabelInValueType[], (val: RawValueType) => DefaultOptionType] => { | ||
const cacheRef = React.useRef({ | ||
values: new Map<RawValueType, LabelInValueType>(), |
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.
这个不应该删掉,labelInValue
的时候需要 cache 住之前的 label
。只有不设置 labelInValue
才应该清理掉。
fix: #1028