Skip to content

Commit

Permalink
fix(chat): fix chat history blinking on conversations change (Issue #…
Browse files Browse the repository at this point in the history
…2401) (#2696)

Co-authored-by: Magomed-Elbi Dzhukalaev <[email protected]>
  • Loading branch information
Gimir and Magomed-Elbi Dzhukalaev authored Nov 28, 2024
1 parent 16853e1 commit 832f371
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/chat/src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { FloatingOverlay } from '@floating-ui/react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
memo,
useCallback,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from 'react';

import { useTranslation } from 'next-i18next';

Expand Down Expand Up @@ -293,7 +301,7 @@ export const ChatView = memo(() => {
};
}, [handleScroll, mergedMessages.length, messageIsStreaming]);

useEffect(() => {
useLayoutEffect(() => {
if (selectedConversations.length > 0) {
const mergedMessages: MergedMessages[] = [];
const firstConversationMessages = excludeSystemMessages(
Expand Down

0 comments on commit 832f371

Please sign in to comment.