-
-
Notifications
You must be signed in to change notification settings - Fork 691
fix: ConversationsItem title display [Object Object] and support extr… #898
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
…a html properties
📝 WalkthroughWalkthrough本次更改主要扩展了会话项(ConversationItem)组件的灵活性。现在每个会话对象可自定义 className 和 style,并支持所有 Changes
Sequence Diagram(s)sequenceDiagram
participant Parent as Conversations
participant Item as ConversationsItem
Note right of Parent: 遍历 convInfo 列表
Parent->>Item: 传递 convInfo 的所有属性(含 className/style)
Item->>Item: 根据 label 类型决定是否设置 title
Item->>UI: 渲染 <li>,应用合并后的 className 和 style
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
components/conversations/interface.ts (1)
49-52
: 修复文档与类型定义的不一致性注释中提到排除了
onClick
和direction
,但类型定义中只排除了onClick
。建议要么更新类型定义排除direction
,要么修正注释内容以保持一致性。/** - * @desc html 原生属性(除 onClick, direction 以外) - * @descEN html native attributes(except onClick, direction) + * @desc html 原生属性(除 onClick 以外) + * @descEN html native attributes(except onClick) */components/conversations/index.zh-CN.md (1)
58-58
: 修正文档描述以保持一致性文档描述提到排除
onClick
和direction
,但实际类型定义中只排除了onClick
。建议修正描述以匹配实际的类型定义。-| htmlAttrs | html 原生属性(除 onClick, direction 以外) | Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> | - | - | +| htmlAttrs | html 原生属性(除 onClick 以外) | Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> | - | - |components/conversations/index.en-US.md (1)
57-57
: 优化文案和版本标注
建议将html native attributes(except onClick, direction)
修改为HTML 原生属性(不包括 onClick 和 direction)
,并在Version
列中补充新增该属性的版本号以便追溯。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
components/conversations/Item.tsx
(1 hunks)components/conversations/index.en-US.md
(1 hunks)components/conversations/index.tsx
(1 hunks)components/conversations/index.zh-CN.md
(1 hunks)components/conversations/interface.ts
(1 hunks)
🔇 Additional comments (3)
components/conversations/Item.tsx (1)
78-78
: 很好的修复!条件设置
title
属性的逻辑正确解决了当info.label
是 React 元素或对象时显示 "[Object Object]" 的问题。这是对原始问题的直接且有效的修复。components/conversations/index.tsx (2)
162-162
: 良好的属性传递实现正确地将
htmlAttrs
展开到ConversationsItem
组件,使得每个对话项都能接受自定义的 HTML 属性。
167-172
: 完善的属性合并逻辑
className
和style
的合并逻辑实现得很好,既保留了现有的样式配置,又允许通过htmlAttrs
进行单项自定义。属性优先级顺序合理。
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.
理论上其他属性都可以透传就好,不需要加新属性。
Bundle ReportChanges will decrease total bundle size by 540.33kB (-79.57%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antdx-array-pushAssets Changed:
|
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.
理论上其他属性都可以透传就好,不需要加新属性。
看下测试用例。 |
原因是 属性展开后 label,disabled,icon 三个传递到了 li 元素。(同时命中 Conversation 以及 pickAttrs) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #898 +/- ##
=======================================
Coverage 92.52% 92.53%
=======================================
Files 69 69
Lines 1552 1554 +2
Branches 400 418 +18
=======================================
+ Hits 1436 1438 +2
Misses 116 116 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…a html properties
中文版模板 / Chinese template
🤔 This is a ...
修复 #897 ,且让其支持其它 html 属性
🔗 Related Issues
💡 Background and Solution
📝 Change Log
Summary by CodeRabbit
新功能
优化