-
Notifications
You must be signed in to change notification settings - Fork 4
[✨Feature/158] 체험 예약 내역 승인, 거절 api 연결 #214
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
61a1565
✨ Feat: 달력 이벤트 조회 및 노출
heyudin e378dd1
Merge branch 'main' into feature/189/monthly-reservation
heyudin 8cf8016
✨ Feat: 예약 승인 거절 api 연결
heyudin 987c587
🐛 Fix: TODO 주석 삭제
heyudin f2a97c8
Merge branch 'main' into feature/158/reservation-manage
heyudin b0af6dd
🐛 Fix: console.log 삭제
heyudin 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
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
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
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
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
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.
PR 설명에 언급된 간헐적인 데이터 불일치 문제를 해결하고 코드를 개선하기 위해,
refetch를 직접 호출하는 대신queryClient.invalidateQueries를 사용하는 것을 권장합니다.invalidateQueries는 특정 쿼리 키와 일치하는 쿼리를 무효화하여react-query가 데이터를 다시 가져오게 하는, 더 안정적이고 선언적인 방법입니다.useQueryClient가 이미 선언되어 있으니 바로 활용할 수 있습니다.또한,
catch블록에서alert()로 에러를 표시하는 것은 사용자 경험에 좋지 않습니다. 일반적인 API 오류는 토스트 알림과 같은 전역 메커니즘으로 처리하는 것이 좋습니다. (Rule: Handle generic, non-field-specific API errors with a global mechanism like a toast notification, rather than assigning the error to an arbitrary input field.) 토스트 메시지 등 더 나은 방식의 피드백을 제공하는 것을 고려해보세요.References
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.
/gemini
이것도 해봤는데 안되던데 결국 데이터 다시 불러오는건 똑같잖아
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.
yujin-fe님, 좋은 질문입니다.
invalidateQueries와refetch모두 최종적으로는 데이터를 다시 불러오는 결과를 가져오는 것은 맞습니다. 하지만react-query의 핵심 개념과 더 나은 데이터 관리 측면에서invalidateQueries를 사용하는 것이 권장됩니다.주요 차이점은 다음과 같습니다:
queryClient.invalidateQueries(권장): 이는 선언적인 방식입니다. 특정queryKey에 해당하는 모든 쿼리를 '오래된(stale)' 상태로 표시하라고react-query에게 지시합니다.react-query는 이 지시를 받고 해당 쿼리를 구독하고 있는 모든 컴포넌트에서 데이터를 자동으로 다시 가져오도록 관리합니다. 이는 여러 컴포넌트가 동일한 데이터를 사용하고 있을 때 데이터 일관성을 유지하는 데 매우 효과적입니다. 캐시 관리와 최적화는react-query가 담당하게 됩니다.refetch: 이는 특정useQuery훅 인스턴스에 대해 데이터를 즉시 다시 가져오도록 강제하는 명령적인 방식입니다. 해당refetch를 호출한 특정 쿼리 인스턴스만 영향을 받으며, 다른 곳에서 동일한queryKey를 사용하는 쿼리들은 자동으로 업데이트되지 않을 수 있습니다.만약
invalidateQueries가 작동하지 않는다고 느끼셨다면,queryKey가 정확히 일치하는지 확인해 볼 필요가 있습니다.react-query는queryKey를 기반으로 쿼리를 식별하므로,invalidateQueries에 전달하는queryKey가useQuery에서 사용된queryKey와 정확히 일치해야 합니다.데이터 일관성 문제를 해결하고
react-query의 이점을 최대한 활용하기 위해invalidateQueries방식을 다시 고려해 보시는 것을 추천합니다.또한,
catch블록에서alert()대신 토스트 알림과 같은 사용자 친화적인 방식으로 에러를 처리하는 것도 사용자 경험을 위해 중요합니다. 이 부분도 함께 개선하는 것을 권장합니다.