Skip to content

perf: wrap list/grid components in React.memo to skip unnecessary re-renders#847

Merged
MaheshtheDev merged 3 commits intosupermemoryai:mainfrom
ved015:perf/usermsg
Apr 12, 2026
Merged

perf: wrap list/grid components in React.memo to skip unnecessary re-renders#847
MaheshtheDev merged 3 commits intosupermemoryai:mainfrom
ved015:perf/usermsg

Conversation

@ved015
Copy link
Copy Markdown
Contributor

@ved015 ved015 commented Apr 10, 2026

Summary

  • Wrap UserMessage, WebsitePreview, YoutubePreview, and FilePreview in React.memo() to prevent unnecessary re renders
  • No behavioral or visual changes

Why

These components render inside lists/grids that can have 50+ items. Any parent state change (eg new streaming token in chat, selection toggle in grid) causes all of them to re render even though their props have not changed.

Impact

  • Skips re-renders for unchanged user messages during assistant streaming
  • Skips re-renders for unchanged preview cards in the document masonry grid
  • Particularly noticeable in long conversations and large document grids

@graphite-app graphite-app bot requested a review from Dhravya April 10, 2026 13:28
@ved015 ved015 changed the title perf : wrap UserMessage in React.memo to skip re-renders in chat list perf: wrap list/grid components in React.memo to skip unnecessary re-renders Apr 10, 2026
Copy link
Copy Markdown
Member

@MaheshtheDev MaheshtheDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great to me

@MaheshtheDev MaheshtheDev merged commit 5cadf5c into supermemoryai:main Apr 12, 2026
5 of 6 checks passed
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.

2 participants