-
Notifications
You must be signed in to change notification settings - Fork 0
fix: ProtectedRoute에서 인증 상태 초기화 로직 추가 #44
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8e3802d
fix: ProtectedRoute에서 인증 상태 초기화 로직 추가
koreahghg db42eec
fix: AuthContext에서 useEffect 훅 추가
koreahghg 3ba8973
fix: CheckReportModal에서 비동기 데이터 로딩 및 오류 처리 개선
koreahghg 74f81c9
fix: AuthContext에서 불필요한 useEffect 훅 제거
koreahghg 5b67bc0
fix: AuthContext에서 코드 정렬 개선
koreahghg 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
Oops, something went wrong.
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.
인증 상태가 비동기적으로 초기화될 때를 대비한
initialized플래그는 좋은 패턴입니다. 하지만 현재AuthContext에서는useState의 지연 초기화(lazy initializer)를 통해 동기적으로 상태를 설정하고 있어 첫 렌더링부터isAuthenticated값이 정확합니다.현재 이
if (!initialized)확인 로직은 불필요하며, 인증된 사용자가 페이지를 새로고침할 때마다 잠시 빈 화면을 보여주게 되어 사용자 경험을 저해할 수 있습니다.따라서
AuthContext와ProtectedRoute양쪽에서initialized관련 로직을 모두 제거하여 코드를 단순화하고 사용자 경험을 개선하는 것을 제안합니다. 나중에 비동기 인증 로직이 추가될 때 이 패턴을 다시 도입하는 것이 좋겠습니다.