-
Notifications
You must be signed in to change notification settings - Fork 3
채팅 메시지 검색 기능 추가 및 리팩토링 #158
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…iveUpWeCarry/front into feature/78-chatting-search
…iveUpWeCarry/front into feature/78-chatting-search
ChannelSelectPage 와 ChatPage 에서 useChat 을 호출함으로 인해 두 개의 소켓 채널이 열리는 문제가 발생함. 두 페이지에서 공통으로 사용하는 레이아웃(ChatLayout)을 만들어서 그 안에서 useChat을 호출함으로써 두 개의 페이지에서 동일한 소켓 채널을 이용할 수 있도록 함
- 소켓 이벤트 이름 상수화 - 웹소켓과 리액트 쿼리를 함께 사용하기 위해 invalidateQueries 사용하는 방식으로 수정
- 기존 cursor 값을 두 개(prev, next) 사용하던 방식은 커서의 개수가 늘어난 만큼 관리가 불편함. 따라서 한 개의 커서값만 관리하도록 수정
- jaehyuk -> jaehyeok
- 이벤트 전파를 막지 않으면 이벤트 버블링 단계에서 ChannelList 의 리스트 아이템에 클릭 이벤트가 전파되어 채팅방이 나가지는게 아니라 채팅방에 들어가짐.
- 별도의 컴포넌트로 분리하기엔 코드가 너무 단순함
- 스크롤이 위로 올라가 있을 때 새로운 메시지가 오면 해당 버튼을 클릭함으로써 바로 새 메시지를 확인할 수 있음
- 메시지 입력 로직과 폼 제출로직을 SearchForm 컴포넌트로 이동
- 파일 이름을 useScroll 에서 useMessageScroll 로 변경함으로써 조금 더 명확한 의미 부여. - 단일 책임 원칙에 맞게 스크롤에 관련된 로직을 한 곳에서 관리하도록 함
- 한쪽 방향만 무한스크롤이 가능하도록 수정. - 검색 이후 무한 스크롤을 사용하려는 경우 검색 창에 x 버튼을 클릭 후 사용할 수 있음.
- 메시지 관련 로직을 useMessageState 훅에 묶어 가독성 및 유지보수성 개선 - 메시지 메모이제이션을 통해 불필요한 리렌더링 방지
- cursor 두 개에서 한 개로 변경
- 내가 문자를 보냈을 때도 '새로운 메시지가 있습니다' 버튼이 뜨는 버그 해결
chaeyun-sim
approved these changes
Mar 14, 2025
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
#78
📝작업 내용
bofore_code_splitting.pdf
after_code_splitting.pdf