perf(chat): skip stable node list mapping
This commit is contained in:
parent
577f0cf7d9
commit
0e90d47d19
1 changed files with 29 additions and 22 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// An enclosing `[data-conversation-scroll]` owns scrolling when present;
|
||||
// otherwise this view owns it. Each row subscribes to one stable node key.
|
||||
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ComponentProps } from 'react'
|
||||
import type {
|
||||
ConversationTimelineSnapshot, RenderMessageImages,
|
||||
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
||||
|
|
@ -199,6 +199,16 @@ function TurnStatus({ startTime, t }: {
|
|||
)
|
||||
}
|
||||
|
||||
type ChatNodeListProps = Omit<ComponentProps<typeof ChatNodeSeat>, 'nodeKey'> & {
|
||||
readonly order: readonly string[]
|
||||
}
|
||||
|
||||
const ChatNodeList = memo(function ChatNodeList({ order, ...seatProps }: ChatNodeListProps) {
|
||||
return order.map(nodeKey => (
|
||||
<ChatNodeSeat key={nodeKey} nodeKey={nodeKey} {...seatProps} />
|
||||
))
|
||||
})
|
||||
|
||||
/**
|
||||
* The chat view slot entry: pure component over the composed props; each
|
||||
* ordered business Node crosses the keyed renderer seat.
|
||||
|
|
@ -743,10 +753,8 @@ export function ChatView({
|
|||
</button>
|
||||
</div>
|
||||
)}
|
||||
{order.map(nodeKey => (
|
||||
<ChatNodeSeat
|
||||
key={nodeKey}
|
||||
nodeKey={nodeKey}
|
||||
<ChatNodeList
|
||||
order={order}
|
||||
useChatNode={useChatNode}
|
||||
useChatNodeProcess={useChatNodeProcess}
|
||||
historyIncomplete={hasMore}
|
||||
|
|
@ -763,7 +771,6 @@ export function ChatView({
|
|||
renderSlot={renderSlot}
|
||||
t={t}
|
||||
/>
|
||||
))}
|
||||
{/* No pending placeholders: questions (ui-user-questions) and approvals
|
||||
(ApprovalPanel) both take over the composer, so a flow card would
|
||||
double-render the same wait. */}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue