Merge branch 'Gurkengewuerz:main' into main
This commit is contained in:
commit
6a6c5d20a4
|
@ -12,17 +12,18 @@ export const ChatHistoryView: FC<{}> = props => {
|
|||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const filteredChatHistory = useMemo(() => {
|
||||
if (searchText.length === 0) return chatHistory;
|
||||
const sortedChatHistory = chatHistory.sort((a, b) => b.id - a.id);
|
||||
|
||||
if (searchText.length === 0) return sortedChatHistory;
|
||||
|
||||
let text = searchText.toLowerCase();
|
||||
|
||||
return chatHistory
|
||||
.filter(entry => (entry.message && entry.message.toLowerCase().includes(text)) || (entry.name && entry.name.toLowerCase().includes(text)))
|
||||
.sort((a, b) => b.id - a.id);
|
||||
return sortedChatHistory
|
||||
.filter(entry => (entry.message && entry.message.toLowerCase().includes(text)) || (entry.name && entry.name.toLowerCase().includes(text)));
|
||||
}, [chatHistory, searchText]);
|
||||
|
||||
useEffect(() => {
|
||||
if (elementRef && elementRef.current && isVisible) elementRef.current.scrollTop = elementRef.current.scrollHeight;
|
||||
if (elementRef && elementRef.current && isVisible) elementRef.current.scrollTop = 0;
|
||||
}, [isVisible]);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -67,7 +68,7 @@ export const ChatHistoryView: FC<{}> = props => {
|
|||
/>
|
||||
<InfiniteScroll
|
||||
rows={filteredChatHistory}
|
||||
scrollToBottom={true}
|
||||
scrollToBottom={false}
|
||||
rowRender={row => {
|
||||
return (
|
||||
<Flex alignItems="center" className="p-1" gap={2}>
|
||||
|
|
Loading…
Reference in New Issue