fix: address review feedback

- Remove unused lastCheckpointInfo parameter from ChatRowContent
- Remove unreachable return null statement
- Optimize useMemo performance for lastCheckpointInfo calculation
This commit is contained in:
Roo Code 2025-07-30 00:03:09 +00:00
parent e9fdf23fd3
commit ee6f07445a
2 changed files with 4 additions and 9 deletions

View file

@ -117,7 +117,6 @@ export const ChatRowContent = ({
onBatchFileResponse,
isFollowUpAnswered,
editable,
lastCheckpointInfo: _lastCheckpointInfo,
}: ChatRowContentProps) => {
const { t } = useTranslation()
const { mcpServers, alwaysAllowMcp, currentCheckpoint: _currentCheckpoint, mode } = useExtensionState()
@ -1345,9 +1344,6 @@ export const ChatRowContent = ({
return null
}
}
// Default return for messages that don't match any case
return null
}
// Create a wrapper component to handle the checkpoint UI
@ -1356,7 +1352,7 @@ export const ChatRowWithCheckpoint: React.FC<ChatRowContentProps> = (props) => {
const { currentCheckpoint } = useExtensionState()
// Render the regular content
const content = <ChatRowContent {...props} lastCheckpointInfo={null} />
const content = <ChatRowContent {...props} />
// Check if we should show checkpoint UI
const shouldShowCheckpoint =

View file

@ -145,10 +145,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
return getLatestTodo(messages)
}, [messages])
// Track the last checkpoint message
// Track the last checkpoint message - optimized to only recalculate when checkpoint messages change
const checkpointMessages = useMemo(() => messages.filter((msg) => msg.say === "checkpoint_saved"), [messages])
const lastCheckpointInfo = useMemo(() => {
// Find the last checkpoint_saved message
const checkpointMessages = messages.filter((msg) => msg.say === "checkpoint_saved")
if (checkpointMessages.length === 0) return null
const lastCheckpoint = checkpointMessages[checkpointMessages.length - 1]
@ -157,7 +156,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
commitHash: lastCheckpoint.text || "",
checkpoint: lastCheckpoint.checkpoint,
}
}, [messages])
}, [checkpointMessages])
const modifiedMessages = useMemo(() => combineApiRequests(combineCommandSequences(messages.slice(1))), [messages])