Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release fe #121

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions fe/src/routes/js/ChatDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function ChatDetailPage() {
// api 를 부르는게 아니며, 랜더링될때 실행될 이유가 없어 useCallback을 사용한다.
const onMessageReceived = useCallback((data) => {
setMessages((prevMessages) => [...prevMessages, data.messages]);
setInputMessage("");
}, []);

// STOMP 클라이언트 사용
Expand Down Expand Up @@ -96,13 +95,17 @@ function ChatDetailPage() {
if (e.key === "Enter" && !e.shiftKey && !isComposing) {
e.preventDefault();
sendMessage(inputMessage, memberId);
setInputMessage("");
}
}}
/>
<button
type="button" // 버튼이 폼을 제출하지 않도록 설정
className={styles.sendButton}
onClick={() => sendMessage(inputMessage, memberId)}
onClick={() => {
sendMessage(inputMessage, memberId);
setInputMessage("");
}}
>
<img
alt="Send"
Expand Down