Skip to content

Commit

Permalink
feat: #259 - 좋아요 버튼 디바운스 함수 조건문 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
dudwns committed Dec 3, 2023
1 parent f7dfa00 commit 6c24afb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/components/common/LinkItem/hooks/useLikeLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,17 @@ const useLikeLink = ({
const debounceUnLikeLink = useMemo(
() =>
debounce(async () => {
if (spaceId) {
await fetchUnLikeLink({ linkId })
await queryClient.invalidateQueries({ queryKey: ['links', spaceId] })
}
await fetchUnLikeLink({ linkId })
await queryClient.invalidateQueries({ queryKey: ['links', spaceId] })
}, 300),
[spaceId, linkId, queryClient],
)

const debounceLikeLink = useMemo(
() =>
debounce(async () => {
if (spaceId) {
await fetchLikeLink({ linkId })
await queryClient.invalidateQueries({ queryKey: ['links', spaceId] })
}
await fetchLikeLink({ linkId })
await queryClient.invalidateQueries({ queryKey: ['links', spaceId] })
}, 300),
[spaceId, linkId, queryClient],
)
Expand Down

0 comments on commit 6c24afb

Please sign in to comment.