-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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: Typography copyable not refreshing text to be copied #48075 #48332
Conversation
Run & review this pull request in StackBlitz Codeflow. |
👁 Visual Regression Report for PR #48332 Failed ❌
Check Full Report for details |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #48332 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 744 744
Lines 12861 12861
Branches 3365 3365
=========================================
Hits 12861 12861 ☔ View full report in Codecov by Sentry. |
https://github.com/ant-design/ant-design/blob/master/components/typography/demo/copyable.tsx#L23 text 还有方法的情况,增加 |
@crazyair 已改成copyConfig.text |
|
copy、edit、expand 等是否可以从 |
这种情况是不是需要用户自己保证?还是有什么好的办法可以组件内部处理掉? |
如果 text 包裹 useCallback,就不会重新 render |
@zombieJ 后续可以优化,copy 元素从 Ellipsis 抽离下,避免 copy.text() 会导致 Ellipsis rerender |
@@ -487,7 +487,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => { | |||
width={ellipsisWidth} | |||
onEllipsis={onJsEllipsis} | |||
expanded={expanded} | |||
miscDeps={[copied, expanded, copyLoading]} | |||
miscDeps={[copied, expanded, copyLoading, copyConfig.text]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miscDeps
is used for trigger measure ellipsis update. This will make useless re-render. I patched in onCopy side, pls help to check: #48347
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
close #48075
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge