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: Transfer with rowKey will be unselectable #43115

Merged
merged 3 commits into from Jun 20, 2023
Merged

fix: Transfer with rowKey will be unselectable #43115

merged 3 commits into from Jun 20, 2023

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Jun 20, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

fix #43113

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Transfer with rowKey makes item unselectable.
🇨🇳 Chinese 修复 Transfer 配置 rowKey 后无法选中的问题。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at d16aac2

This pull request enhances the Transfer component by memoizing the selected keys and fixing a bug with the rowKey prop. It also updates the test case for the Transfer component and adds a warning for the deprecated version 5.6.2 in the post-script.js file.

🔍 Walkthrough

🤖 Generated by Copilot at d16aac2

  • Fix a bug in the Transfer component when using a function as rowKey (link,link,link)
    • Add a test case in components/transfer/__tests__/index.test.tsx to check the selection and checkbox behavior with a custom rowKey function (link)
    • Add a helper function flattenKeys in components/transfer/hooks/useSelection.ts to convert a set of keys to a string for memoization (link)
    • Use flattenKeys to memoize the effect of updating the selected keys in the useSelection hook (link)
  • Add the version 5.6.2 to the deprecated versions list in scripts/post-script.js (link)

@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2023

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
./dist/antd.min.js 376.73 KB (+29 B 🔺)
./dist/antd-with-locales.min.js 436.16 KB (+25 B 🔺)

@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (8d15644) 100.00% compared to head (d16aac2) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #43115   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          648       648           
  Lines        10957     10959    +2     
  Branches      2975      2975           
=========================================
+ Hits         10957     10959    +2     
Impacted Files Coverage Δ
components/transfer/hooks/useSelection.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zombieJ zombieJ merged commit 5d65881 into master Jun 20, 2023
96 checks passed
@zombieJ zombieJ deleted the fix-transfer branch June 20, 2023 05:41
@Yyutaa
Copy link

Yyutaa commented Jun 21, 2023

现在好像不使用rowkey也会导致无法选中,是不是改动涉及到其他地方了

@PeachScript PeachScript mentioned this pull request Jun 25, 2023
20 tasks
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.

Transfer穿梭框设置了rowKey之后,无法使用onSelectChange来设置selectedKeys
5 participants