Skip to content

fix: incorrect display when value change from with label to without label - #1029

Open
xulingling0 wants to merge 1 commit into
react-component:masterfrom
xulingling0:fix-1028-value
Open

fix: incorrect display when value change from with label to without label#1029
xulingling0 wants to merge 1 commit into
react-component:masterfrom
xulingling0:fix-1028-value

Conversation

@xulingling0

Copy link
Copy Markdown
Contributor

fix: #1028

@vercel

vercelBot commented Feb 26, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

NameStatusPreviewCommentsUpdated (UTC)
select✅ Ready (Inspect)Visit Preview💬 Add feedbackFeb 27, 2024 2:58am

@codecov

codecovBot commented Feb 26, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.78%. Comparing base (2535b87) to head (cb8a623).

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.
📢 Have feedback on the report? Share it here.

Comment threadsrc/hooks/useCache.ts Outdated
Comment threadsrc/hooks/useCache.ts
return {
...item,
label: prevValueCache.get(item.value)?.label,
label: prevOptionCache.get(item.value)?.label,

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

此处不一定取label, 需结合
image

Comment threadsrc/hooks/useCache.ts
valueOptions: Map<RawValueType, DefaultOptionType>,
): [LabelInValueType[], (val: RawValueType) => DefaultOptionType] => {
const cacheRef = React.useRef({
values: new Map<RawValueType, LabelInValueType>(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这个不应该删掉,labelInValue 的时候需要 cache 住之前的 label。只有不设置 labelInValue 才应该清理掉。

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

当value 没有 label 属性时,并且options 不包含 value 时,应当将 value 作为 label

3 participants

@xulingling0@zombieJ@yoyo837