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: correct update option's label when update value (equal label) in options #580

Merged
merged 1 commit into from
Dec 24, 2020

Conversation

jameslahm
Copy link
Contributor

Fix ant-design/ant-design#28495, if item.value === item.label in options, the true label will be replaced by cacheLabel. Add isCacheable may help fix this.

@vercel
Copy link

vercel bot commented Dec 23, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/select/ddgikif37
✅ Preview: https://select-git-fork-jameslahm-master.react-component.vercel.app

@codecov
Copy link

codecov bot commented Dec 23, 2020

Codecov Report

Merging #580 (be51210) into master (d393076) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #580   +/-   ##
=======================================
  Coverage   99.27%   99.27%           
=======================================
  Files          20       20           
  Lines         962      963    +1     
  Branches      324      324           
=======================================
+ Hits          955      956    +1     
  Misses          6        6           
  Partials        1        1           
Impacted Files Coverage Δ
src/interface/generator.ts 100.00% <ø> (ø)
src/hooks/useCacheDisplayValue.ts 100.00% <100.00%> (ø)
src/utils/valueUtil.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d393076...be51210. Read the comment docs.

@afc163
Copy link
Member

afc163 commented Dec 24, 2020

Could you add test case?

@jameslahm
Copy link
Contributor Author

Test case is here

select/tests/Select.test.tsx

Lines 1615 to 1617 in be51210

wrapper.setProps({ options: [{ value: 903, label: 903 }] });
expect(findSelection(wrapper).text()).toEqual('903');

@afc163 afc163 merged commit ff5eaeb into react-component:master Dec 24, 2020
Sign up for free to 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.

Select的options更新不会触发选择框内容更新
2 participants