π Fix a social login duplication issue#110
Merged
Conversation
This was
linked to
issues
Feb 28, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
π μμ λ΄μ©
useAuthStore((state) => state)μ²λΌ μ€ν μ΄ μ 체λ₯Ό κ°μ Έμ€λ λ°©μμ νμν μνλ§ κ°κ° κ°μ Έμ€λλ‘ μμ νμ΅λλ€. μ΄λ₯Ό ν΅ν΄ λ‘κ·ΈμΈ μ±κ³΅ μ λ°μνλ μ€ν μ΄ μ λ°μ΄νΈκ° μ΄ ν μ μ¬μ©νλ λͺ¨λ μ»΄ν¬λνΈμ λΆνμν 리λ λλ§μ μ λ°νμ§ μλλ‘ νμ΅λλ€.useCallbackμ μ©:handleSocialLoginμ ν¬ν¨ν λͺ¨λ νΈλ€λ¬ ν¨μλ₯ΌuseCallbackμΌλ‘ κ°μΈ ν¨μ μ°Έμ‘°λ₯Ό κ³ μ νμ΅λλ€. μ΄μ 리λ λλ§μ΄ λ°μν΄λ ν¨μκ° μλ‘ μμ±λμ§ μμ΅λλ€.useRefκ°λ μΆκ°:loginAttemptedλΌλ μ°Έμ‘°(ref)λ₯Ό μ¬μ©νμ¬,useEffectκ° μ΄λ€ μ΄μ λ‘λ μ¬μ€νλλλΌλ μ€μ μλ² μμ²μ μ»΄ν¬λνΈ μλͺ μ£ΌκΈ° λμ λ± ν λ²λ§ λκ°λλ‘ λ³΄μ₯νμ΅λλ€.isLoggedIn:true)λΌλ©΄ λ‘μ§μ μ¦μ μ€λ¨νλλ‘ νμ¬ μ΄μ€ μ²λ¦¬λ₯Ό μμ² μ°¨λ¨νμ΅λλ€.π μμ λ‘κ·ΈμΈ μ€λ³΅ μμ²μ μ λ°μνλ? Geminiμ μ견
1. λΆμμ ν ν¨μ μ°Έμ‘° (
useAuthν )src/hooks/useAuth.tsλ΄μhandleSocialLoginν¨μλuseCallbackμΌλ‘ κ°μΈμ Έ μμ§ μμ΅λλ€. λ°λΌμuseAuthν μ΄ λ¦¬λ λλ§λ λλ§λ€handleSocialLoginν¨μλ νμ μλ‘μ΄ μ°Έμ‘°λ₯Ό κ°μ§κ² λ©λλ€.2. μν μ λ°μ΄νΈμ μν μ ν
useAuthν μuseAuthStore((state) => state)λ₯Ό ν΅ν΄ Zustand μ€ν μ΄ μ 체λ₯Ό ꡬλ νκ³ μμ΅λλ€. 첫 λ²μ§Έ μμ λ‘κ·ΈμΈ μμ²μ΄ μ±κ³΅νλ©΄login(user, token)μ΄ νΈμΆλμ΄ μ€ν μ΄ μνκ° μ λ°μ΄νΈλλλ°, μ΄λuseAuthν μ΄ λ¦¬λ λλ§λλ©΄μ μλ‘μ΄handleSocialLoginν¨μλ₯Ό λ°νν©λλ€.3.
SocialCallbackμuseEffectμ¬μ€νsrc/routes/SocialCallback.tsxμuseEffectλ μμ‘΄μ± λ°°μ΄μhandleSocialLoginμ κ°μ§κ³ μμ΅λλ€.첫 λ²μ§Έ μμ² μ±κ³΅ μ§ν 리λ λλ§μ΄ λ°μνλ©΄, μμ‘΄μ± λ°°μ΄μ μλ
handleSocialLoginμ μ°Έμ‘°κ° λ°λμκΈ° λλ¬ΈμuseEffectκ° μ¦μ ν λ² λ μ€νλ©λλ€. μ΄λ URLμλ μμ§ codeκ° λ¨μμμΌλ―λ‘ λμΌν μ½λλ‘ λ λ²μ§Έ μμ²μ΄ μλ²λ‘ μ μ‘λ©λλ€.