perf: avoid per-message review metadata checks
Compute review transfer state once per chat render Hide transfer actions when linked review sessions are inactive Remove session-list scans from individual message rows
This commit is contained in:
@@ -31,6 +31,7 @@ import { copyTextToClipboard } from '@/lib/clipboard';
|
||||
import { FadeInOnReveal } from './message/FadeInOnReveal';
|
||||
import { streamPerfCount } from '@/stores/utils/streamDebug';
|
||||
import { areOptionalRenderRelevantMessagesEqual, areRenderRelevantMessagesEqual, areRelevantTurnGroupingContextsEqual } from './message/renderCompare';
|
||||
import type { ReviewTransferDirection } from '@/lib/reviewFlow';
|
||||
|
||||
const ToolOutputDialog = lazyWithChunkRecovery(() => import('./message/ToolOutputDialog'));
|
||||
|
||||
@@ -133,6 +134,7 @@ interface ChatMessageProps {
|
||||
activeStreamingPhase?: StreamPhase | null;
|
||||
animateUserOnMount?: boolean;
|
||||
onUserAnimationConsumed?: (messageId: string) => void;
|
||||
reviewTransferDirection?: ReviewTransferDirection | null;
|
||||
}
|
||||
|
||||
const ChatMessage: React.FC<ChatMessageProps> = ({
|
||||
@@ -147,6 +149,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
||||
activeStreamingPhase = null,
|
||||
animateUserOnMount = false,
|
||||
onUserAnimationConsumed,
|
||||
reviewTransferDirection = null,
|
||||
}) => {
|
||||
const { isMobile, isTablet, hasTouchInput } = useDeviceInfo();
|
||||
const alwaysShowMessageActions = isMobile || isTablet;
|
||||
@@ -1138,6 +1141,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
||||
turnGroupingContext={turnGroupingContext}
|
||||
errorMessage={assistantErrorText}
|
||||
errorVariant={assistantErrorVariant}
|
||||
reviewTransferDirection={reviewTransferDirection}
|
||||
/>
|
||||
|
||||
</div>
|
||||
@@ -1171,6 +1175,7 @@ export default React.memo(ChatMessage, (prev, next) => {
|
||||
)
|
||||
&& prev.isInActiveTurn === next.isInActiveTurn
|
||||
&& prev.activeStreamingPhase === next.activeStreamingPhase
|
||||
&& prev.reviewTransferDirection === next.reviewTransferDirection
|
||||
&& prev.assistantHeaderMessageId === next.assistantHeaderMessageId
|
||||
&& prev.animateUserOnMount === next.animateUserOnMount
|
||||
&& prev.onUserAnimationConsumed === next.onUserAnimationConsumed
|
||||
|
||||
Reference in New Issue
Block a user