-
-
Notifications
You must be signed in to change notification settings - Fork 618
fix: sanitize clone element in MeasureCell #1375
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
Conversation
…n the diffs. First, I need to understand what changes were made. \n\nLooking at the diffs: \n\n1. In MeasureCell.tsx, they added an import for sanitizeCloneElement and used it on the title.\n2. In MeasureRow.tsx, they removed the manual cloning of the title and just passed column?.title directly, relying on the new sanitizeCloneElement function.\n3. They added a new file reactNodeUtil.tsx with the sanitizeCloneElement function, which clones React elements and strips certain props (like data-*, id, ref, onFocus, onBlur) to avoid issues in table cells.\n\nSo the main change is adding a utility to sanitize React nodes for table cells, which is a refactor or maybe a feat? Wait, the type should be based on the change. Since it's adding a new utility function and using it to clean up the code (removing manual cloning in MeasureRow), maybe it's a refactor. Or maybe a feat because it's a new feature? Wait, no, the utility is to fix potential issues, so maybe refactor. Wait, let's check the types: fix, feat, build, chore, ci, docs, style, refactor, perf, test.\n\nThe changes are: added a new utility function (reactNodeUtil.tsx) and updated two existing files to use it. So this is a refactor because it's restructuring the code to use a new utility instead of manual cloning. Also, the utility is meant to sanitize React nodes, which is a refactor to improve code structure and avoid duplication.\n\nSo the commit message should be something like "refactor: add sanitizeCloneElement utility to clean React nodes for table cells". Wait, but need to be concise. Let's check the length. Let's see: "refactor: add sanitizeCloneElement utility to sanitize React nodes in table cells". That's under 72 characters. Wait, let's count: "refactor: add sanitizeCloneElement utility to sanitize React nodes in table cells" – let's see: "refactor: add sanitizeCloneElement utility to sanitize React nodes in table cells" – that's 68 characters. Perfect.\n\nWait, but let's make sure the type is correct. The change is adding a new utility function and using it to replace manual cloning in two places. So it's a refactor because it's restructuring the code to use a new utility instead of duplicating logic. Yes, that's a refactor.\n\nSo the commit message should be "refactor: add sanitizeCloneElement utility to sanitize React nodes in table cells".</think>\n<|begin_of_box|>refactor: add sanitizeCloneElement utility to sanitize React nodes in table cells<|end_of_box|>
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## antd-5.x #1375 +/- ##
============================================
- Coverage 97.69% 97.64% -0.06%
============================================
Files 77 78 +1
Lines 7672 7718 +46
Branches 1164 1174 +10
============================================
+ Hits 7495 7536 +41
- Misses 171 176 +5
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
close ant-design/ant-design#55039
close ant-design/ant-design#55244
还是得用递归,性能问题做了一层缓存优化。