Conversation
Closed
3 tasks
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Q&A 메인/상세 페이지에서 세션별 질문방 SSE를 구독해 질문/댓글/이해도 체크 변경 사항을 실시간으로 반영하고, 백엔드에서도 관련 이벤트 발행을 보강한 PR입니다.
Changes:
- 프론트에
fetch기반 SSE 구독 유틸을 추가하고, Q&A 목록/상세 페이지에 SSE 이벤트 처리 로직을 연결 - Q&A 목록에서 댓글/질문/이해도 이벤트에 따라 질문 그룹(인기/미해결/해결)과 이해도 카운트를 실시간 갱신
- 백엔드에서 질문 상태 변경 및 댓글 수정/삭제에 대한 SSE 이벤트 발행(트랜잭션 커밋 이후) 추가
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/utils/sse.js | fetch 스트림 기반 SSE 구독/파싱/재연결 유틸 추가 및 세션 질문방 구독 헬퍼 제공 |
| frontend/src/pages/qna/QnAListPage.js | 세션 질문방 SSE 구독 및 질문/댓글/이해도 이벤트 기반 실시간 상태 갱신 로직 추가 |
| frontend/src/pages/qna/QnADetailPage.module.css | 대댓글(리플) 렌더링을 위한 레이아웃/반응형 스타일 추가 |
| frontend/src/pages/qna/QnADetailPage.js | 상세 페이지 SSE 구독 추가, 댓글/대댓글 트리 렌더링 및 이미지 blob 변환 로직 공통화 |
| backend/src/main/java/com/example/Piroin/project/domain/question/service/QuestionService.java | 좋아요/수정/삭제/해결/댓글 수정·삭제 시 커밋 후 SSE 이벤트 발행 로직 추가 |
| backend/src/main/java/com/example/Piroin/project/domain/question/service/QuestionEventService.java | comment-updated, question-updated 이벤트 브로드캐스트 메서드 추가 |
| backend/src/main/java/com/example/Piroin/project/domain/question/dto/QuestionResDTO.java | CommentUpdatedEvent, QuestionUpdatedEvent SSE DTO 추가 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
+34
| const POPULAR_LIKE_THRESHOLD = 5; | ||
|
|
||
| const getCreatedAtTime = (question) => new Date(question.createdAt ?? 0).getTime(); | ||
|
|
||
| const sortQuestionGroups = (groups) => ({ | ||
| popularQuestions: [...groups.popularQuestions].sort( | ||
| (a, b) => (b.likeCount ?? 0) - (a.likeCount ?? 0) || getCreatedAtTime(b) - getCreatedAtTime(a) | ||
| ), | ||
| unresolvedQuestions: [...groups.unresolvedQuestions].sort( | ||
| (a, b) => getCreatedAtTime(b) - getCreatedAtTime(a) | ||
| ), | ||
| resolvedQuestions: [...groups.resolvedQuestions].sort( | ||
| (a, b) => getCreatedAtTime(b) - getCreatedAtTime(a) | ||
| ), | ||
| }); | ||
|
|
||
| const getQuestionGroupKey = (question) => { | ||
| if (question.isResolved) return 'resolvedQuestions'; | ||
| if ((question.likeCount ?? 0) >= POPULAR_LIKE_THRESHOLD) return 'popularQuestions'; | ||
| return 'unresolvedQuestions'; | ||
| }; |
Comment on lines
+291
to
+297
| let blobImageUrl = null; | ||
| if (eventData.imageUrl) { | ||
| try { | ||
| const imgRes = await authFetch(eventData.imageUrl); | ||
| const blob = await imgRes.blob(); | ||
| blobImageUrl = URL.createObjectURL(blob); | ||
| } catch { |
Comment on lines
+30
to
+37
| const createBlobImageUrl = async (imageUrl) => { | ||
| if (!imageUrl) return null; | ||
|
|
||
| try { | ||
| const imgRes = await authFetch(imageUrl); | ||
| const blob = await imgRes.blob(); | ||
| return URL.createObjectURL(blob); | ||
| } catch { |
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
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.
#️⃣연관된 이슈
#185
📝작업 내용
프론트 SSE 구독 유틸 추가
frontend/src/utils/sse.js추가fetch기반 SSE 스트림 구독 로직 구현subscribeQuestionEvents(sessionId)유틸로 질문방 이벤트 구독 공통화질문 메인 페이지 SSE 연결
QnAListPage에서 세션별 질문방 SSE 이벤트 구독comment-created,comment-updated,question-created,question-updated,understanding-check-created,understanding-response-updated이벤트 처리질문 메인 댓글 실시간 반영
질문 메인 이해도 실시간 반영
respondedCount,attendanceCount,understoodCount,notUnderstoodCount실시간 반영질문 상세 페이지 댓글 실시간 반영
QnADetailPage에서도 세션별 SSE 이벤트 구독질문 상태 변경 SSE 이벤트 반영
question-updated이벤트 발행댓글 수정/삭제 SSE 이벤트 추가
CommentUpdatedEvent추가