Skip to content

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

Merged
merged 4 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/conversations/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ const ConversationsItem: React.FC<ConversationsItemProps> = (props) => {

// ============================ Render ============================
return (
<li {...domProps} className={mergedCls} onClick={onInternalClick} title={`${info.label}`}>
<li
title={typeof info.label === 'object' ? undefined : `${info.label}`}
{...domProps}
className={mergedCls}
onClick={onInternalClick}
>
{info.icon && <div className={`${prefixCls}-icon`}>{info.icon}</div>}
<Typography.Text className={`${prefixCls}-label`}>{info.label}</Typography.Text>
{!disabled && menu && (
Expand Down
9 changes: 7 additions & 2 deletions components/conversations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,17 @@ const Conversations: React.FC<ConversationsProps> = (props) => {
{groupList.map((groupInfo, groupIndex) => {
const convItems = groupInfo.data.map((convInfo: Conversation, convIndex: number) => (
<ConversationsItem
{...convInfo}
key={convInfo.key || `key-${convIndex}`}
info={convInfo}
prefixCls={prefixCls}
direction={direction}
className={classnames(classNames.item, contextConfig.classNames.item)}
style={{ ...contextConfig.styles.item, ...styles.item }}
className={classnames(
classNames.item,
contextConfig.classNames.item,
convInfo.className,
)}
style={{ ...contextConfig.styles.item, ...styles.item, ...convInfo.style }}
menu={typeof menu === 'function' ? menu(convInfo) : menu}
active={mergedActiveKey === convInfo.key}
onClick={onConversationItemClick}
Expand Down
4 changes: 3 additions & 1 deletion components/conversations/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ type GroupType = string;
* @desc 会话数据
* @descEN Conversation data
*/
export interface Conversation extends AnyObject {
export interface Conversation
extends AnyObject,
Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> {
/**
* @desc 唯一标识
* @descEN Unique identifier
Expand Down
Loading