Skip to content

Conversation

@alessandroliva
Copy link

@alessandroliva alessandroliva commented Nov 26, 2025

In this PR I propose a fix for React.memo comparison functions in Messages and PreviewMessage that always returne false, effectively disabling memoization.

Problem

Both components define a custom comparison function for React.memo, but they end with an unconditional return false.
Because the final line is always false, these components re-render on every parent update, regardless of whether the relevant props actually changed.

Testing

Verified the app still updates when:

  • New messages are added.
  • Streaming status changes (e.g. streamingready).
  • Votes change.
    Confirmed that, when props are unchanged, the components are now eligible to be skipped by React.memo, reducing unnecessary re-renders in longer chats.

@vercel
Copy link

vercel bot commented Nov 26, 2025

@alessandroliva is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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