-
Notifications
You must be signed in to change notification settings - Fork 3
Fix: beforeErrorHook에 전역 상태 초기화 및 TanStack Query 캐시 무효화 로직 추가 #547
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
2 commits
Select commit
Hold shift + click to select a range
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
💡 Verification agent
🧩 Analysis chain
초기화 로직이 명확해졌습니다.
refetch를 명시적으로 호출하여 앱 로드 시 사용자 데이터를 강제로 가져오는 로직이 명확해졌습니다. 이는 인증 상태 동기화를 보장하는 좋은 접근 방식입니다.다만
useQuery는 기본적으로 컴포넌트 마운트 시에도 실행되므로,refetch()호출이 중복 요청을 발생시킬 가능성이 있습니다.중복 요청 여부를 확인하기 위해 다음 스크립트를 실행하여
useQuery의 기본 설정을 확인해보세요:Also applies to: 17-20
🏁 Script executed:
Length of output: 87
tsx 파일 타입 필터가 인식되지 않아, 전체 파일을 대상으로
useQuery와QueryClient를 다시 검색해주세요.🏁 Script executed:
Length of output: 33839
중복 네트워크 요청 방지 검토 필요
AuthInitializer.tsx에서 useUser 훅을 통해
{ refetch }를 분해한 뒤,useEffect로 마운트 시 다시refetch()를 호출하고 있습니다.그러나
useUser내부에는 다음과 같이useQuery를 사용하고 있어:getMe요청을 자동 실행staleTime기본값(0)으로 마운트마다 재요청이 보장됨따라서
useEffect에서 추가로 호출하는refetch()는 불필요한 중복 요청을 유발할 수 있습니다.수정 제안:
useEffect내의refetch()호출 제거staleTime/refetchOnMount옵션을 조정해 의도한 동작만 발생하도록 변경교정이 필요한 위치:
const { refetch } = useUser();useEffect(() => { refetch() }, [refetch])🤖 Prompt for AI Agents