Skip to content

fix: Inefficient DOM manipulation in widget streaming#37

Open
mrwind-up-bird wants to merge 1 commit intomainfrom
autofix/dd2853cd/inefficient-dom-manipulation-i
Open

fix: Inefficient DOM manipulation in widget streaming#37
mrwind-up-bird wants to merge 1 commit intomainfrom
autofix/dd2853cd/inefficient-dom-manipulation-i

Conversation

@mrwind-up-bird
Copy link
Copy Markdown
Collaborator

AutoFix: Inefficient DOM manipulation in widget streaming

Category: performance
Severity: medium

Issue

The _updateStreamingMessage function searches through all message bubbles to find the last one for each streaming update. This creates O(n) complexity for each character streamed, causing performance degradation with long conversations.

Fix

The fix caches a reference to the last message element in _lastMessageElement instead of searching through all DOM elements on each streaming update. This eliminates the O(n) complexity by providing direct O(1) access to the element that needs updating. The cache is properly managed by clearing it during full re-renders and when showing typing indicators.


Generated by nyxCore AutoFix

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