Skip to content
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

[Hotfix] 레이싱 게임에서 점수 백분위 api 연결이 중복해서 여러번 호출되는 문제 해결 #51

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

minani-0621
Copy link
Contributor

✅ 구현사항

  • useDebounce 커스텀 훅 구현
  • 레이싱 게임 점수 백분위 api를 게임 종료 시 한 번만 호출하도록 구현

Copy link
Collaborator

@Dunkkkk Dunkkkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리팩토링은 같이 해봅시다!

const [isButtonDisabled, setIsButtonDisabled] = useState<boolean>(false);
const debouncedDistance = useDebounce(state.distance, 50);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

distance가 아니라 topRate에 거는것이 좋아보입니다!


function useDebounce<T>(value: T, delay: number): T {
const [debouncedValue, setDebouncedValue] = useState(value);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isInit같은 변수를 useState로 만들어서 최초에 접근까지 제거하면 좋을 것 같습니다!

@Dunkkkk Dunkkkk merged commit 5462746 into develop Aug 19, 2024
1 check passed
@Dunkkkk Dunkkkk deleted the hotfix/refactorTopRateApi branch August 19, 2024 07:49
@minani-0621 minani-0621 added the Hotfix hotfix label Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hotfix hotfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants