diff --git a/src/components/Chat/ChatDirect.tsx b/src/components/Chat/ChatDirect.tsx index edf588b..848c12a 100644 --- a/src/components/Chat/ChatDirect.tsx +++ b/src/components/Chat/ChatDirect.tsx @@ -383,6 +383,8 @@ const clearEditorContent = () => { const onReply = useCallback((message)=> { setReplyMessage(message) + editorRef?.current?.chain().focus() + }, []) diff --git a/src/components/Chat/ChatList.tsx b/src/components/Chat/ChatList.tsx index 6c990cc..72c6e86 100644 --- a/src/components/Chat/ChatList.tsx +++ b/src/components/Chat/ChatList.tsx @@ -108,32 +108,40 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR getScrollElement: () => parentRef.current, estimateSize: () => 80, // Provide an estimated height of items, adjust this as needed overscan: 10, // Number of items to render outside the visible area to improve smoothness - measureElement: - typeof window !== 'undefined' && - navigator.userAgent.indexOf('Firefox') === -1 - ? element => { - return element?.getBoundingClientRect().height - } - : undefined, + getItemKey: React.useCallback( + (index) => messages[index].signature, + [messages] + ), }); return (
-
-
+
+
{rowVirtualizer.getVirtualItems().map((virtualRow) => { const index = virtualRow.index; let message = messages[index]; @@ -205,7 +213,7 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR ); })}
- +
{showScrollButton && (