Repository navigation
refactor: semantic of message and notification - #55199
Conversation
|
|
|
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 Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
👁 Visual Regression Report for PR #55199 Failed ❌
Important There are 1 diffs found in this PR: 🔄
|
Summary of ChangesHello @thinkasany, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the way semantic class names and styles are handled across the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the merging of class names and styles in message and notification components by extracting common logic into mergeStyles and utilizing the existing mergeClassNames helper functions. The changes improve code reuse and maintainability. My review includes a suggestion to improve the type safety of the new mergeStyles function.
size-limit report 📦
|
More templates
commit: |
Bundle ReportChanges will decrease total bundle size by 7.91MB (-67.8%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
Files in
Files in
|
Deploying ant-design with
|
| Latest commit: |
136dd0c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8f5df839.ant-design.pages.dev |
| Branch Preview URL: | https://refactor-semantic-hooks.ant-design.pages.dev |
Deploying ant-design-next with
|
| Latest commit: |
136dd0c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://624173fb.ant-design-next.pages.dev |
| Branch Preview URL: | https://refactor-semantic-hooks.ant-design-next.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #55199 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 798 798
Lines 14747 14747
Branches 3897 3896 -1
=========================================
Hits 14747 14747 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @@ -219,21 +219,14 @@ export function useInternalMessage( | |||
| resolveFunctionStyle(value, config), | |||
There was a problem hiding this comment.
还有两个可以优化的点:
这个 resolveFunctionStyle 方法没有依赖到组件内部的状态,可以放在外面作为纯函数,另外可以简化一下:
const resolveFunctionStyle = <T extends AnyObject>(
value: T | ((config: any) => T),
info: { props: AnyObject },
) => {
return typeof value === 'function' ? value(info) : value;
};还有调用的地方没必要用 map,徒增了复杂度,直接用就行:
const semanticClassNames = resolveFunctionStyle(configClassNames, { props: config });
const semanticStyles = resolveFunctionStyle(styles, { props: config });




🤔 This is a ...
🔗 Related Issues
💡 Background and Solution
📝 Change Log