refactor: streamline chat scroll manager

- Removed unused activeTurnAnchorId and activeTurnSpacerHeight from MemoryDebugPanel.
- Simplified useChatScrollManager by eliminating unnecessary state and functions related to active turn anchoring.
- Updated loadMessages function signatures to accept an optional limit parameter across message and session stores.
- Enhanced scroll behavior in useScrollEngine to support dynamic bottom tracking during animations.
- Improved event stream handling to allow for resyncing messages with a specified limit.
- Cleaned up session memory state to remove active turn properties, focusing on viewport anchoring.
This commit is contained in:
Bohdan Triapitsyn
2026-01-20 03:23:39 +02:00
parent 8fa16baf3b
commit 6544b12e78
15 changed files with 318 additions and 937 deletions
@@ -63,8 +63,7 @@ interface ChatMessageProps {
};
onContentChange?: (reason?: ContentChangeReason) => void;
animationHandlers?: AnimationHandlers;
scrollToBottom?: (options?: { instant?: boolean; force?: boolean; clearAnchor?: boolean }) => void;
isPendingAnchor?: boolean;
scrollToBottom?: (options?: { instant?: boolean; force?: boolean }) => void;
turnGroupingContext?: TurnGroupingContext;
}
@@ -74,7 +73,6 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
nextMessage,
onContentChange,
animationHandlers,
isPendingAnchor = false,
turnGroupingContext,
}) => {
const { isMobile, hasTouchInput } = useDeviceInfo();
@@ -834,7 +832,6 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
)}
data-message-id={message.info.id}
ref={messageContainerRef}
style={isPendingAnchor ? { visibility: 'hidden' } : undefined}
>
<div className="chat-column">
{isUser ? (