Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📜 refactor: Optimize Longer Message Thread Performance #3610

Merged
merged 1 commit into from
Aug 11, 2024

Conversation

danny-avila
Copy link
Owner

@danny-avila danny-avila commented Aug 11, 2024

I implemented several improvements to enhance the performance of long message threads and refactored related components. These changes resolve a long standing problem for the application from legacy code.

  • Refactored the Markdown component to accept more specific props, reducing the need for context lookups within the component.
  • Implemented useMemo hooks in MessageContent and Part components to optimize cursor and latest message calculations.
  • Removed redundant components (Markdown.tsx and MessageContent.tsx) from the Messages/Content directory, consolidating functionality into the Chat/Messages/Content directory.
  • Improved type safety and null checks throughout the codebase, particularly in the validateIframe utility function.
  • Simplified conditional rendering logic in the Markdown component, making it more readable and maintainable.
  • Updated import statements and component references to reflect the new structure and removed components.

Overall, the "after" state shows significant improvements in duration, render time, and passive effects.

Before

image

After

image

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have tested my changes thoroughly
  • Local unit tests pass with my changes

@danny-avila danny-avila merged commit 02847af into main Aug 11, 2024
3 checks passed
@danny-avila danny-avila deleted the refactor/optimize-long-threads branch August 11, 2024 10:08
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Sep 17, 2024
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