Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Yen Truong committed Oct 17, 2023
1 parent 3a588ac commit 4f3f265
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/components/ChatPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ export function ChatPanel(props: ChatPanelProps) {

// Request initial message only if there are no existing messages and no ongoing request.
useEffect(() => {
setFetchInitialMessage(messages.length === 0 && canSendMessage)
}, [messages.length, canSendMessage])
setFetchInitialMessage(messages.length === 0 && canSendMessage);
}, [messages.length, canSendMessage]);

useEffect(() => {
if (!fetchInitialMessage) {
return;
}
// Ensures that the fetch for the initial message occurs only once
setFetchInitialMessage(false)
// Ensures that the fetch for the initial message occurs only once
setFetchInitialMessage(false);
const res = stream ? chat.streamNextMessage() : chat.getNextMessage();
res.catch((e) => (handleError ? handleError(e) : defaultHandleApiError(e)));
}, [chat, stream, handleError, defaultHandleApiError, fetchInitialMessage]);
Expand Down Expand Up @@ -131,10 +131,7 @@ export function ChatPanel(props: ChatPanelProps) {
<div className={cssClasses.container}>
{header}
<div className={cssClasses.messagesScrollContainer}>
<div
ref={messagesContainer}
className={cssClasses.messagesContainer}
>
<div ref={messagesContainer} className={cssClasses.messagesContainer}>
{messages.map((message, index) => (
<div key={index} ref={setMessagesRef(index)}>
<MessageBubble
Expand Down

0 comments on commit 4f3f265

Please sign in to comment.