Skip to content

[FIX] improve room management flows and persist room rule edits#13

Open
ydking0911 wants to merge 4 commits intomainfrom
fix/#12/방-관리-기능-개선-및-버그-수정

Hidden character warning

The head ref may contain hidden characters: "fix/#12/\ubc29-\uad00\ub9ac-\uae30\ub2a5-\uac1c\uc120-\ubc0f-\ubc84\uadf8-\uc218\uc815"
Open

[FIX] improve room management flows and persist room rule edits#13
ydking0911 wants to merge 4 commits intomainfrom
fix/#12/방-관리-기능-개선-및-버그-수정

Conversation

@ydking0911
Copy link
Copy Markdown
Contributor

요약

방 관리 흐름과 채팅/검색 화면의 방 상태 동기화를 개선했습니다.
특히 방 관리에서 규칙 편집 후 저장해도 이전 값으로 보이던 문제를 수정했고,
방 삭제/방 나가기/룸메이트 내보내기 이후 관련 화면 상태가 자연스럽게 반영되도록 정리했습니다.

변경 사항

1. 방 관리(MyRoomPage) 개선

  • 방 규칙 편집 저장 시 선택값이 올바르게 반영되도록 수정
  • 추가 규칙 선택 로직을 단일 선택 기준으로 정리
  • 귀가/소등 시간값이 비어 있을 때 저장이 실패하지 않도록 보정
  • 방 규칙 재조회 경로를 일관되게 정리
  • 방장 기준으로 지원자 탭 노출 여부 제어
  • 방장용 방 삭제 기능 추가
  • 룸메이트 내보내기 기능 연결
  • 방 나가기 기능 연결
  • 방장 최종 확정 가능 조건을 UI에서 제어
  • 규칙 수정 실패 시 사용자에게 에러 토스트가 보이도록 개선

2. 채팅방(ChatRoomPage) 상태 동기화

  • 그룹 채팅 멤버 목록에 룸메이트 메타 정보(confirmStatus, isMe) 반영
  • 방장이 채팅 패널에서 룸메이트를 내보낼 수 있도록 UI/동작 추가
  • 강퇴/방 삭제 알림 수신 시 채팅방 목록과 메시지 상태를 store에서 제거
  • 채팅방 나가기 시 store 상태도 함께 정리
  • STOMP 구독 내부에서 stale closure를 피하도록 ref 동기화 처리

3. 방 검색(RoomSearchPage) 상태 동기화

  • 방 삭제/방 나가기 이후 location state를 받아 목록 상태를 정리하도록 수정
  • 모집/지원/관심 목록 재조회 흐름 보강
  • 로그인/비로그인 상태에 따라 방 만들기 버튼과 탭 노출 조건 정리
  • otherNotes가 빈 값일 때도 일관되게 처리

4. 공통 유틸 및 API 추가

  • room rule 편집 관련 유틸 추가
    • buildRoomRuleFetchPath
    • selectSingleOption
    • normalizeRoomRuleTimeValue
  • 룸메이트 내보내기/방 삭제용 roomApi 추가
  • 삭제된 방 상태 정리용 roomSearchDeleteState 유틸 추가
  • 채팅 store에 채팅방/그룹채팅 정리 메서드 추가

기대 효과

  • 방 관리에서 수정한 규칙이 저장 후 다시 이전 값으로 보이는 문제를 줄입니다.
  • 방 삭제/강퇴/방 나가기 이후 채팅방 목록과 방 검색 화면 상태가 어긋나지 않도록 맞춥니다.
  • 방장 기준 액션(지원자 관리, 최종 확정, 강퇴, 삭제)의 UI 조건이 더 명확해집니다.

참고

  • 방 규칙 수정이 실제 DB에 반영되려면 백엔드의 room rule update no-op 수정이 함께 반영되어야 합니다.
  • FE PR과 BE PR을 함께 배포하는 것이 안전합니다.

@ydking0911 ydking0911 requested review from KoungQ and Copilot April 20, 2026 04:38
@ydking0911 ydking0911 self-assigned this Apr 20, 2026
@ydking0911 ydking0911 added the fix label Apr 20, 2026
@ydking0911 ydking0911 linked an issue Apr 20, 2026 that may be closed by this pull request
8 tasks
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fe Ready Ready Preview, Comment Apr 20, 2026 1:22pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

방 관리/채팅/검색 화면에서 “방 상태 동기화”와 “방 규칙 편집 저장 반영” 흐름을 개선하고, 방 삭제/나가기/강퇴 이후 스토어 및 화면 상태 정리를 추가하는 PR입니다.

Changes:

  • 방 관리(MyRoomPage)에서 규칙 저장 반영, 방 삭제/나가기/룸메이트 내보내기 액션 및 UI 조건을 정리
  • 채팅방(ChatRoomPage)에서 룸메이트 메타(confirmStatus/isMe) 반영, 강퇴/삭제 알림 수신 시 스토어 정리, stale closure 방지용 ref 동기화 추가
  • 방 검색(RoomSearchPage)에서 location state 기반으로 삭제/나가기 후 목록/확장/메모/좋아요 상태를 정리하고, 게스트/로그인 UI 노출 조건을 정리

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/types/bun-test.d.ts bun:test 타입 선언 추가로 유틸 테스트 타입체크 지원
src/store/chatStore.ts 채팅방/그룹채팅방 제거 유틸 추가(스토어 정리 기능)
src/services/roomApi.ts 룸메이트 강퇴/방 삭제 API 클라이언트 추가
src/services/chatApi.ts roomNo로 내 그룹 채팅방 찾는 유틸 추가
src/pages/roomSearchDeleteState.js 방 삭제/나가기 이후 RoomSearchPage 상태 pruning 유틸 추가
src/pages/roomSearchDeleteState.d.ts pruning 유틸 타입 정의 추가
src/pages/myRoomRuleUtils.ts 룸 규칙 fetch 경로/단일 선택/시간값 보정 유틸 추가
src/pages/myRoomRuleUtils.test.ts myRoomRuleUtils에 대한 단위 테스트 추가
src/pages/RoomSearchPage.tsx location state 기반 상태 정리 + 게스트 UI 조건 + otherNotes 처리 보강
src/pages/MyRoomPage.tsx 룰 저장 반영/삭제/나가기/강퇴 기능 연결 및 호스트 UI 조건 정리
src/pages/ChatRoomPage.tsx 멤버 메타 병합, 강퇴 UI, 알림 구독 시 스토어 정리, stale closure 방지

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pages/RoomSearchPage.tsx Outdated
Comment on lines +895 to +899
useEffect(() => {
if (!deletedRoomNo) return

const nextState = pruneDeletedRoomState(
{
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This effect reads multiple state values (recruitingRooms/appliedRooms/joinedRooms/expandedRoomIds/roomRules/roomOtherNotes/likedRoomIds) but the dependency array only includes deletedRoomNo. With the repo’s eslint settings (react-hooks/exhaustive-deps + --max-warnings 0), this will raise a lint warning and fail CI. Instead of adding all those deps (which can cause repeated runs), consider applying the prune via functional setState updates per field, or consume and then clear the location.state (replace navigation) so the effect can safely depend on all required values without looping.

Copilot uses AI. Check for mistakes.
Comment thread src/pages/ChatRoomPage.tsx Outdated
Comment on lines +281 to +282
const notification: NotificationMessage = JSON.parse(msg.body)

Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON.parse(msg.body) in the notification subscription is unguarded. If the server ever sends a non-JSON payload (or an unexpected schema), this will throw inside the STOMP callback and can break message handling / crash the page. Wrap the parse in a try/catch and ignore (or surface) invalid messages safely.

Suggested change
const notification: NotificationMessage = JSON.parse(msg.body)
let parsedNotification: unknown
try {
parsedNotification = JSON.parse(msg.body)
} catch (error) {
console.error('Invalid notification message payload:', error, msg.body)
return
}
if (
!parsedNotification ||
typeof parsedNotification !== 'object' ||
typeof (parsedNotification as NotificationMessage).chatRoomNo !== 'string' ||
typeof (parsedNotification as NotificationMessage).type !== 'string'
) {
console.error('Unexpected notification message payload:', parsedNotification)
return
}
const notification = parsedNotification as NotificationMessage

Copilot uses AI. Check for mistakes.
Comment on lines +285 to +296
if (notification.type === 'KICKED_FROM_ROOM') {
removeChatRoom(notification.chatRoomNo)
toast.error('방에서 강퇴되었습니다.')
navigate('/rooms/search')
return
}

if (notification.type === 'ROOM_DELETED') {
removeChatRoom(notification.chatRoomNo)
toast.error('방이 삭제되었습니다.')
navigate('/rooms/search')
}
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This STOMP connection effect’s dependency array is only [chatRoomNo], but it now also closes over values like removeChatRoom, navigate, appendMessage, updateRoomOnNewMessage, and fetchMessages. With react-hooks/exhaustive-deps enabled (and --max-warnings 0), this will trigger a lint warning. Either add the missing dependencies (if they’re stable) or move the referenced callbacks into refs (similar to fetchMembersRef / markAsReadAndSyncRef) so the effect can remain keyed by chatRoomNo only.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] 방 관리 기능 개선 및 버그 수정

3 participants