Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Collaborator
|
수고하셨습니다! |
juha399
approved these changes
Feb 9, 2025
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.
#️⃣ Issue Number
#145
📝 요약(Summary)
localStorage에 저장된 크레딧 개수의 변동을 감지하여, 크레딧 개수가 감소되었을 때 GET 리퀘스트를 보내 업데이트된 데이터로 리렌더링
🛠️ PR 유형
어떤 변경 사항이 있나요?
📚 코드 이해에 필요한(혹은 본인이 이해하는데 사용한) 레퍼런스 목록
useRef의 값은 렌더링 후에 갱신되기 때문에 prevCreditsRef.current와 credits를 비교할 때 두 값이 같은 상황이 발생할 수 있다.
이를 해결하기 위해 setTimeout을 사용하여 렌더링이 완료된 후 prevCreditsRef.current에 credits 값을 할당하도록 했다.