Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Aug 31, 2025

Description

[Provide a brief description of the changes in this PR]

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

Summary by cubic

Memoized chat message components and callbacks to cut unnecessary re-renders and speed up message rendering, especially during streaming and edits. No UI changes.

  • Performance
    • Wrapped AIMessage in React.memo with a custom comparator; added a memoized AIMessage wrapper that stabilizes props via useMemo/useCallback.
    • Converted HumanMessage to a memoized component with a targeted comparator (content, messageId, files length, streaming flag).
    • Memoized createRegenerator, handleFeedback, handleMessageEdit, and onMessageSelection with useCallback to keep stable function refs.
    • Adjusted regenerator to use parentMessage.message directly to avoid stale references.
    • Added optional render timing logs in ChatPage to flag slow renders; removed noisy packets console log.

Copy link

vercel bot commented Aug 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
internal-search Building Building Preview Comment Aug 31, 2025 9:34pm

@Weves Weves closed this Aug 31, 2025
@Weves Weves deleted the improve-message-render-performance-2 branch August 31, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant