diff --git a/app/soapbox/features/chats/components/chat-page/chat-page.tsx b/app/soapbox/features/chats/components/chat-page/chat-page.tsx index 407d49e7b..dbe50d385 100644 --- a/app/soapbox/features/chats/components/chat-page/chat-page.tsx +++ b/app/soapbox/features/chats/components/chat-page/chat-page.tsx @@ -1,5 +1,5 @@ import classNames from 'clsx'; -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'; import { matchPath, Route, Switch, useHistory } from 'react-router-dom'; import { Stack } from 'soapbox/components/ui'; @@ -44,7 +44,7 @@ const ChatPage: React.FC = ({ chatId }) => { setHeight(fullHeight - top + offset); }; - useEffect(() => { + useLayoutEffect(() => { calculateHeight(); }, [containerRef.current]);