(Go: >> BACK << -|- >> HOME <<)

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 error when reset data in some cases #42785

Merged
merged 12 commits into from
Jun 7, 2023

Conversation

BoyYangzai
Copy link
Contributor
@BoyYangzai BoyYangzai commented Jun 1, 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

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English fix: transfer error when reset data in some cases
🇨🇳 Chinese 修复一些 cases 下重置数据出现 seletcedKeys 错误的情况

☑️ 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 fe08ed8

Fixed a bug in the transfer component that caused an error when the data source and the target keys were reset. Added a test case to verify the fix and improved the logic of the useEffect hook in components/transfer/index.tsx.

🔍 Walkthrough

🤖 Generated by Copilot at fe08ed8

  • Fix error when reset data in transfer component (link, link, link)
  • Add imports of DefaultRecordType and Button in test file components/transfer/__tests__/index.test.tsx (link)
  • Modify useEffect hook in components/transfer/index.tsx to handle no props.selectedKeys case (link)
  • Add test case in components/transfer/__tests__/index.test.tsx to check no error when data source and target keys are reset by a button in the footer (link)

@github-actions
Copy link
Contributor
github-actions bot commented Jun 1, 2023

Prepare preview

@codecov
Copy link
codecov bot commented Jun 1, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (9b22fd4) 100.00% compared to head (1423192) 100.00%.

❗ Current head 1423192 differs from pull request most recent head b3a5f23. Consider uploading reports for the commit b3a5f23 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #42785   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          648       646    -2     
  Lines        10957     10935   -22     
  Branches      2976      2970    -6     
=========================================
- Hits         10957     10935   -22     
Impacted Files Coverage Δ
components/transfer/index.tsx 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

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

@afc163
Copy link
Member
afc163 commented Jun 2, 2023

看下这里的报错提示:https://github.com/ant-design/ant-design/pull/42785/files

@zombieJ
Copy link
Member
zombieJ commented Jun 2, 2023

感觉这个实现不太好,太多的 setSourceSelectedKeys,最好是直接给 sourceSelectedKeys 做个 memo 过滤,这样统一收口

@zombieJ zombieJ merged commit 47f30ee into ant-design:master Jun 7, 2023
9 checks passed
@zombieJ zombieJ mentioned this pull request Jun 19, 2023
16 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 bug when resetting data
4 participants