Critical performance fixes for MULTIX chat mode: 1. isAgentThinking - Simplified to only check last message - Previously iterated ALL messages with .some() on every store update - Each getMessage() call created a reactive subscription - Now only checks the last message (O(1) instead of O(n)) 2. lastAssistantIndex - Memoized with createMemo - Changed from function to createMemo for proper caching - Added early exit optimization for common case 3. Auto-scroll effect - Removed isAgentThinking dependency - The thinking-based scroll was firing on every reactive update - Now only triggers on message count changes - Streaming scroll is handled by the interval-based effect These combined fixes prevent the cascading reactive loop that was freezing the UI during message send.
6c63bb7d7d
·
2025-12-24 22:49:31 +04:00
History