[#60] Refactor/60/워크스페이스상세페이지 - #61
Merged
Hidden character warning
The head ref may contain hidden characters: "Refactor/60/\uc6cc\ud06c\uc2a4\ud398\uc774\uc2a4\uc0c1\uc138\ud398\uc774\uc9c0"
Merged
Conversation
- 관리자 전용 영수증 선택 다운로드 기능 추가 (체크박스 UI, 전체 선택) - 게시자 드롭다운 멤버 목록 자동 갱신 (visibilitychange + 마운트 시 refetch) - 페이지네이션 위치 복원 (sessionStorage 활용)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- 워크스페이스 간 이동 시 이전 페이지 번호가 남아 다른 워크스페이스의 페이지네이션 상태를 오염시키던 버그 수정 - 평소 페이지 변경 시에는 스토리지에 저장하지 않고, 영수증 상세 페이지로 이동하는 직전에만 현재 페이지를 저장하도록 변경 - 컴포넌트 초기화 시 sessionStorage에서 값을 읽어온 후 즉시 삭제하여 다른 경로로 진입할 때는 0페이지(1페이지)로 초기화되도록 개선
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.
❓이슈
📝 Description
워크스페이스 상세 페이지(
/workspace/[workspaceId]/page.tsx)의 3가지 문제를 리팩토링합니다.1. 관리자 전용 선택 다운로드
isAdmin조건부로 체크박스 컬럼을 렌더링합니다 (데스크탑 테이블 / 모바일 리스트 모두 적용).selectedReceiptIds: Set<number>로 선택 상태를 관리하며, 페이지나 데이터가 변경되면 자동 초기화됩니다.selectedReceiptIds.size > 0일 때만선택 다운로드 (N)버튼이 노출됩니다.e.stopPropagation()을 적용했습니다.useExportSelectedReceipts훅을 사용하며, payload에workspaceId와receiptIds모두 포함합니다.2. 게시자 드롭다운 자동 갱신
기존에는
useGetWorkspaceMembers의staleTime이 5분이라 마이페이지에서 이름 변경 후 돌아와도 캐시된 멤버 목록이 그대로 노출되는 문제가 있었습니다.refetchMembers()를 호출합니다.refetch()는staleTime을 무시하고 서버에 요청합니다.visibilitychange이벤트로 브라우저 탭이 포커스될 때도 갱신합니다.3. 페이지네이션 상태 복원
useSearchParams+router.replace방식은 Next.js App Router 뒤로가기에서 안정적으로 동작하지 않아sessionStorage로 교체했습니다.sessionStorage에workspace_page_{workspaceId}키로 현재 페이지를 저장합니다.useState의 lazy initializer에서sessionStorage를 바로 읽어 초기 렌더부터 올바른 페이지를 표시합니다.setPage(0)으로 리셋,sessionStorage도 함께 초기화됩니다.🌀 PR Type
어떤 변경 사항이 있나요?
✅ Checklist
PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.
Test Checklist