-
Notifications
You must be signed in to change notification settings - Fork 1
[FIX] 시간 총량제 타이머 한 팀 시간 소진 시 버그 수정 #386
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
Conversation
|
Caution Review failedThe pull request is closed. Walkthrough타이머 흐름에 상대팀 완료 플래그( Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as 사용자
participant View as TimerView
participant Comp as TimeBasedTimer
participant Hook as useTimeBasedTimer
User->>View: 시작/토글 액션
View->>Comp: props (isOpponentDone, denominator, ...)
Comp->>Hook: startTimer(isOpponentDone)
activate Hook
Hook->>Hook: updateDenominator(isOpponentDone)
Hook->>Hook: interval 시작 → progress 계산 (denominator 사용)
Hook-->>Comp: 진행률/상태 업데이트
deactivate Hook
Note over Hook,Comp: 상대팀 완료 여부에 따라 denominator 기반 계산 경로 전환
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/page/TimerPage/components/TimeBasedTimer.tsx(5 hunks)src/page/TimerPage/components/TimerView.tsx(2 hunks)src/page/TimerPage/hooks/useTimeBasedTimer.ts(9 hunks)
🔇 Additional comments (1)
src/page/TimerPage/hooks/useTimeBasedTimer.ts (1)
43-66: ...
jaeml06
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 확인했습니다. dev환경에서 정상적으로 진행바가 차오르는 것을 확인했습니다.
리뷰 내용은 한건이 있으나 사소한 내용이라고 생각되니 approve 드리겠습니다
useon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dev 환경에서 정상 작동 확인했습니다 !!!! PR에 잘 설명해 주셔서 이해하기 편했습니다 감사해요 !! 🤩
🚩 연관 이슈
closed #384
📝 작업 내용
들어가기에 앞서
제가 PR을 쉽게 써보려고는 했는데 로직이 좀 복잡해서 생각대로 되지 않네요... 그래서 Gemini의 도움을 받아 최대한 받아들이기 쉽게 적어 봤습니다. 그럼에도 불구하고 이해가 어려운 부분이 있으시면 Discord로 편하게 질문 남겨주세요! 빠르게 답변 드리도록 하겠습니다.
요약
상대 팀의 시간이 모두 소진되었을 때, 시간 총량제 타이머의 원형 진행률 표시가 비정상적으로 계산되던 문제를 해결합니다.
세부 내용
1. 문제 상황
시간 총량제 타이머에는 한 팀의 시간(
팀당 발언 시간)이 모두 소진되면, 상대 팀은 더 이상1회당 발언 시간에 제한받지 않고 남은 시간을 한 번에 모두 사용할 수 있는 특별한 규칙이 있습니다.하지만 이 규칙이 적용되는 상황에서, 타이머의 진행률을 계산하는 기준 시간(분모)이 올바르게 갱신되지 않아 원형 프로그레스 바가 비정상적으로 표시되는 문제가 있었습니다.
예시 시나리오
팀당 발언 시간3분 40초 남음 /1회당 발언 시간은 2분으로 설정됨2. 원인 분석
문제의 원인은 두 가지였습니다.
useState와 같은 상태(State)로 관리되지 않고, 렌더링마다 실시간으로 재계산되는 일반const변수로 선언되어 있었습니다. 이 때문에 타이머가 시작되는 시점의 값을 고정하지 못하고, 시간이 흐름에 따라 기준값이 계속 변하는 문제가 발생했습니다.3. 해결 방안
이 문제를 해결하기 위해, 진행률의 기준 시간인
denominator(분모)를useTimeBasedTimer훅 내부에서useState로 관리하도록 구조를 변경했습니다.이제 denominator 값은 다음과 같은 주요 시점에 맞게 명시적으로 갱신됩니다:
결과적으로, 상대 팀의 시간이 소진되는 등의 특수 상황에서도 타이머가 시작되는 순간의 정확한 시간을 기준으로 삼아 진행률을 올바르게 계산하고 표시합니다.
🏞️ 스크린샷 (선택)
2025-10-04.231525.mp4
🗣️ 리뷰 요구사항 (선택)
제가 테스트를 하긴 하였으나 꼭 로컬에서 다양한 시나리오로 테스트 진행해보신 후 문제 있는지 확인해주세요. 제가 빼먹은 게 있을 수 있으니... 항상 감사합니다 😭
Summary by CodeRabbit
신기능
버그 수정