import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import Conversation from './Conversation'; import { swr } from '~/utils/fetchers'; import useDidMountEffect from '~/hooks/useDidMountEffect'; export default function Conversations() { const { data, error, isLoading, mutate } = swr('http://localhost:3050/convos'); const conversations = data; const [isHovering, setIsHovering] = useState(false); const { conversationId } = useSelector((state) => state.convo); useDidMountEffect(() => mutate(), [conversationId]); // const currentRef = useRef(null); // const scrollToTop = () => { // currentRef.current?.scrollIntoView({ behavior: 'smooth' }); // }; // // this useEffect triggers the following warning in the Messages component (but not here): // // Warning: Internal React error: Expected static flag was missing. // useEffect(() => { // scrollToTop(); // }, [conversationId]); return (