diff --git a/app/soapbox/features/chats/components/chat-list.tsx b/app/soapbox/features/chats/components/chat-list.tsx index a64178b78..abf592d41 100644 --- a/app/soapbox/features/chats/components/chat-list.tsx +++ b/app/soapbox/features/chats/components/chat-list.tsx @@ -27,7 +27,7 @@ const ChatList: React.FC = ({ onClickChat, useWindowScroll = false }) const [isNearBottom, setNearBottom] = useState(false); const [isNearTop, setNearTop] = useState(true); - const isEmpty = chats?.length === 0; + const isEmpty = (!chats || chats.length === 0); const handleLoadMore = () => { if (hasNextPage && !isFetching) { @@ -64,9 +64,7 @@ const ChatList: React.FC = ({ onClickChat, useWindowScroll = false }) useWindowScroll={useWindowScroll} data={chats} endReached={handleLoadMore} - itemContent={(_index, chat) => ( - - )} + itemContent={(_index, chat) => } components={{ ScrollSeekPlaceholder: () => , // Footer: () => hasNextPage ? : null, diff --git a/app/soapbox/features/chats/components/chat-message-list.tsx b/app/soapbox/features/chats/components/chat-message-list.tsx index 7d935be7c..dcad9582f 100644 --- a/app/soapbox/features/chats/components/chat-message-list.tsx +++ b/app/soapbox/features/chats/components/chat-message-list.tsx @@ -333,7 +333,9 @@ const ChatMessageList: React.FC = ({ chat, autosize }) => { // Stick scrollbar to bottom. useEffect(() => { if (isNearBottom()) { - scrollToBottom(); + setTimeout(() => { + scrollToBottom(); + }, 25); } // First load. @@ -348,10 +350,6 @@ const ChatMessageList: React.FC = ({ chat, autosize }) => { markChatAsRead(); }, [formattedChatMessages.length]); - // useEffect(() => { - // scrollToBottom(); - // }, [messagesEnd.current]); - useEffect(() => { // Restore scroll bar position when loading old messages. if (!initialLoad) { diff --git a/app/soapbox/features/chats/components/chat-settings.tsx b/app/soapbox/features/chats/components/chat-settings.tsx index fd2bdf23a..bd7dda913 100644 --- a/app/soapbox/features/chats/components/chat-settings.tsx +++ b/app/soapbox/features/chats/components/chat-settings.tsx @@ -7,13 +7,13 @@ import List, { ListItem } from 'soapbox/components/list'; import { Avatar, Divider, HStack, Icon, Stack, Text, Toggle } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useAppDispatch } from 'soapbox/hooks'; -import { useChat, useChatSnoozes } from 'soapbox/queries/chats'; +import { useChat, useChatSilences } from 'soapbox/queries/chats'; import ChatPaneHeader from './chat-pane-header'; const ChatSettings = () => { const dispatch = useAppDispatch(); - const { isSnoozed, handleSnooze } = useChatSnoozes(); + const { isSilenced, handleSilence } = useChatSilences(); const { chat, setEditing, toggleChatPane } = useChatContext(); const { deleteChat } = useChat(chat?.id as string); @@ -89,8 +89,8 @@ const ChatSettings = () => { - - + + diff --git a/app/soapbox/features/chats/components/chat.tsx b/app/soapbox/features/chats/components/chat.tsx index 2566b4170..fa559ec5f 100644 --- a/app/soapbox/features/chats/components/chat.tsx +++ b/app/soapbox/features/chats/components/chat.tsx @@ -12,11 +12,6 @@ interface IChatInterface { } const Chat: React.FC = ({ chat, onClick }) => { - // Temporary: remove once bad Staging data is removed. - if (!chat.account) { - return null; - } - return (