diff --git a/src/routes/chat/SessionList/index.tsx b/src/routes/chat/SessionList/index.tsx index 25208b63..e131a799 100644 --- a/src/routes/chat/SessionList/index.tsx +++ b/src/routes/chat/SessionList/index.tsx @@ -13,7 +13,7 @@ export interface ChatSession { unread?: number; } type Props = { - tempSession: ChatSession; + tempSession?: ChatSession; }; const SessionList: FC = ({ tempSession }) => { const [deleteId, setDeleteId] = useState(); diff --git a/src/routes/chat/index.tsx b/src/routes/chat/index.tsx index 50c4649c..ca4a8561 100644 --- a/src/routes/chat/index.tsx +++ b/src/routes/chat/index.tsx @@ -29,8 +29,13 @@ export default function ChatPage() { }; const tmpSession = sessionUids.findIndex((i) => i == user_id) > -1 - ? null - : { key: `user_${user_id}`, mid: null, unreads: 0, id: user_id, type: "user" }; + ? undefined + : { + key: `user_${user_id}`, + unreads: 0, + id: +user_id, + type: "user" as "user" | "channel" + }; // console.log("temp uid", tmpUid); const placeholderVisible = channel_id == 0 && user_id == 0; return (