Skip to content

Conversation

@cho-subin
Copy link
Contributor

@cho-subin cho-subin commented Nov 1, 2023

close #226

💡 개요

채팅리스트에 실시간으로 오는 마지막 채팅을 보여주기 위한 작업입니다.

채팅리스트 미리보기에 Sse를 사용한 이유는

  1. 클라이언트 쪽에서 데이터를 보낼것이 없음.
  2. sse가 소켓보다 가볍기 때문.

📝 작업 내용

  1. 적용할 sse를 커스텀 훅으로 생성

  2. sse가 return한 message값으로 해당하는 list contents 업데이트

  3. message값으로 list contents 업데이트시 chatlist의 모든 컴포넌트들이 재렌더링됨.

2023-12-17.4.21.48.mov

이유를 찾아보니 커스텀훅의 상태를 변경하면 해당 훅을 사용하는 컴포넌트도 리렌더링 되기 때문.
내가 useSSE를 사용하는 위치가 chatList의 최상단 컴포넌트였기 때문에 모든 컴포넌트들이 재렌더링이 되었음.
그래서 useSSE를 chatBody.tsx로 옮겨서 사용.

2023-12-17.5.52.11.mov

‼️ 주의 사항

🔗 참고자료

@vercel
Copy link

vercel bot commented Nov 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2023 3:27pm

@cho-subin cho-subin changed the title Feature/chat sse [계속 진행중] feat#226 chatlist sse 적용 Nov 2, 2023
@moonjieun
Copy link
Contributor

확인하였습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat:chatlist 부분 SSE 적용

4 participants