-
Notifications
You must be signed in to change notification settings - Fork 0
에러 고침 #125
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
Merged
Merged
에러 고침 #125
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
잠재적 버그 및 위험 요소
병렬 처리에서의 오류 처리:
loadCalendarCalories함수 내에서 각 날짜에 대한 API 호출 오류가 발생할 경우, 이미 반환된 결과가 누락될 수 있습니다. 만약 API 응답이 성공햇지만calories필드가 자주 없으면, 최악의 경우 해당 날짜의 칼로리가 항상 0으로 설정됩니다. 이는 실제 데이터 손실로 이어질 수 있습니다.메모리 누수 가능성:
useEffect에 의존성 배열이loadTodayProgress를 포함하고 있습니다. 이 함수가 비동기적으로 작동하는 경우, 컴포넌트가 언마운트된 후에도 상태 업데이트를 시도할 수 있습니다. 이는 메모리 누수를 초래할 수 있습니다.상태 업데이트 및 렌더링:
setCalendarCalories호출에서prev를 통해 상태를 업데이트하고 있는데, 이 방법은 적절하긴 하지만, 상태 변경이 자주 일어날 경우 렌더링 성능에 영향을 줄 수 있습니다.개선 제안
오류 로깅 개선: 각 날짜의 API 호출 성공 여부를 더 효과적으로 체크하고, 발생한 모든 오류를 로그로 기록하여 디버깅을 용이하게 해야 합니다.
불필요한 렌더링 최소화:
setCalendarCalories와 같은 상태 업데이트 호출이 자주 발생하면, 이로 인해 불필요한 렌더링이 발생할 수 있습니다. 그러므로 배치 업데이트를 고려해보세요.최적화된 API 호출: 여러 날짜에 대한 API 호출을 병렬 처리하고 있는데, API 호출의 수가 많아지면 최악의 경우 성능 저하가 발생할 수 있습니다. 이를 위해 효율적으로 배치할 수 있는 방법을 고려하는 것이 좋습니다.
의존성 배열 명확화:
useEffect의 의존성 배열에setSelectedDate를 포함하는 것을 다시 고려하세요. 이 구조는 의도하지 않은 업데이트를 초래할 수 있습니다.