diff --git a/frontend/src/components/Conversation/Conversation.tsx b/frontend/src/components/Conversation/Conversation.tsx index 5606844a..6d864a5e 100644 --- a/frontend/src/components/Conversation/Conversation.tsx +++ b/frontend/src/components/Conversation/Conversation.tsx @@ -1,9 +1,5 @@ -import { - useEffect, - useRef, - useState, - // useState -} from "react"; +import { useEffect, useRef, useState } from "react"; +import { isAxiosError } from "axios"; import { Message } from "./Message"; import { Navigate, useParams } from "react-router-dom"; import ExpandingInput from "./ExpandingInput"; @@ -113,6 +109,15 @@ export const Conversation = () => { ); } + + if ( + (isAxiosError(getMessagesError) && + getMessagesError.response?.status === 404) || + !connectionsData?.connections?.length + ) { + return ; + } + if (!isSuccessGetMessages) { return (
@@ -120,13 +125,6 @@ export const Conversation = () => {
); } - if ( - // @ts-expect-error, status is not known - getMessagesError?.status === 404 || - !connectionsData?.connections?.length - ) { - return ; - } return (