Repository navigation
fix: use latest Transfer onSelectChange callback - #59307
Conversation
|
|
👁 Visual Regression Report for PR #59307 Passed ✅
🎊 Congrats! No visual-regression diff found.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughTransfer 的选择处理函数现在使用最新的 ChangesTransfer 回调更新
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The Transfer callback update has no identified blocking behavior and is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 小兔挥爪改回调, Comment |
Bundle ReportChanges will decrease total bundle size by 44 bytes (-0.0%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
More templates
commit: |
| } | ||
| }, | ||
| [sourceSelectedKeys, targetSelectedKeys], | ||
| [sourceSelectedKeys, targetSelectedKeys, onSelectChange], |
There was a problem hiding this comment.
Maybe use util useEvent instead?
There was a problem hiding this comment.
Thanks for the suggestion! Switched handleSelectChange to useEvent from @rc-component/util. The existing regression tests are unchanged, and the Transfer suite passes with 57 tests and 5 snapshots.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #59307 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 834 834
Lines 16026 16025 -1
Branches 4205 4205
=========================================
- Hits 16026 16025 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
Fixes #59306
💡 Background and Solution
When a parent replaces or removes
onSelectChangewhile the selected keys stay unchanged, Transfer can keep invoking the previous callback. For example, switching the active project from A to B and then selecting an item reports project A.Use
useEventfrom@rc-component/utilforhandleSelectChange, keeping its reference stable while subsequent selection events read the current callback and selected keys. Regression tests cover callback replacement in both lists and callback removal.Validation:
npx jest --config .jest.js --runInBand --no-cache --runTestsByPath components/transfer/__tests__/index.test.tsx: 57 tests and 5 snapshots passed.📝 Change Log
onSelectChangeafter the callback is replaced or removed.onSelectChange后仍调用旧回调的问题。