sdy

update ChatContainer

......@@ -11,7 +11,6 @@ import {
import useInput from "../../Hooks/useInput";
import { toast } from "react-toastify";
export default withRouter(({ location }) => {
const [messageArr, setMessageArr] = useState([]);
const { pathname } = location;
......@@ -20,7 +19,7 @@ export default withRouter(({ location }) => {
const message = useInput("");
let messageObj, roomNum, messageArray;
let messageObj, roomNum, messageArray; // messageArray 는 useQuery 로 얻은 데이터 인데 undefined 가 아닌 데이터
const { data: getRoom } = useQuery(GET_ROOM_BY_NAME, {
variables: { roomName },
......@@ -36,7 +35,7 @@ export default withRouter(({ location }) => {
subscribeToMore,
data: messageList,
error: msgQueryError,
loading: msgQueryyLoading,
loading: msgQueryLoading,
} = useQuery(SEE_ALL_MESSAGE, {
variables: { roomId: roomNum },
});
......@@ -52,7 +51,7 @@ export default withRouter(({ location }) => {
if (messageArr) {
setMessageArr(messageArr.seeAllMessage, [msgQueryError, messageArr]);
}
}, [msgQueryyLoading]);
}, [msgQueryLoading]);
const subscribeToNewMessage = () => {
subscribeToMore({
......