Skip to content

Commit c13151d

Browse files
authored
fix: the scroll button is not displayed by default (#552)
* fix: the scroll button is not displayed by default * docs: update notes
1 parent 07c4ab0 commit c13151d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Information about release notes of Coco Server is provided here.
4242
- fix: switch server assistant and session unchanged #540
4343
- fix: history list height #550
4444
- fix: secondary page cannot be searched #551
45+
- fix: the scroll button is not displayed by default #552
4546

4647
### ✈️ Improvements
4748

src/components/Assistant/ChatContent.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ export const ChatContent = ({
5252
return state.setCurrentSessionId;
5353
});
5454

55-
useEffect(() => {
56-
setCurrentSessionId(activeChat?._id);
57-
}, [activeChat?._id]);
58-
5955
const { t } = useTranslation();
6056

6157
const uploadFiles = useChatStore((state) => state.uploadFiles);
@@ -65,10 +61,15 @@ export const ChatContent = ({
6561
const scrollRef = useRef<HTMLDivElement>(null);
6662
const [isAtBottom, setIsAtBottom] = useState(true);
6763

64+
useEffect(() => {
65+
setIsAtBottom(true);
66+
setCurrentSessionId(activeChat?._id);
67+
}, [activeChat?._id]);
68+
6869
useEffect(() => {
6970
scrollToBottom();
7071
}, [
71-
activeChat?.messages,
72+
activeChat?.id,
7273
query_intent?.message_chunk,
7374
fetch_source?.message_chunk,
7475
pick_source?.message_chunk,
@@ -173,7 +174,7 @@ export const ChatContent = ({
173174

174175
{sessionId && <SessionFile sessionId={sessionId} />}
175176

176-
<Splash assistantIDs={assistantIDs}/>
177+
<Splash assistantIDs={assistantIDs} />
177178

178179
<ScrollToBottom scrollRef={scrollRef} isAtBottom={isAtBottom} />
179180
</div>

0 commit comments

Comments
 (0)