-
Notifications
You must be signed in to change notification settings - Fork 0
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
useMutationPostLike type에서 data 제거 #917
Conversation
|
src/api/post/hooks.ts
Outdated
? previousPost.data.likeCount && previousPost.data.likeCount - 1 | ||
: previousPost.data.likeCount && previousPost.data.likeCount + 1; | ||
const newLikeCount = previousPost.isLiked | ||
? previousPost.likeCount && previousPost.likeCount - 1 |
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.
슬랙에서도 이야기했었지만, 이렇게 될 경우 likeCount 가 0 이 될 때 falsy 한 값으로 처리되게 되어요. 그래서 제가 슬랙에 보내드린 사진처럼 || 0 을 활용하거나, 서버 api 에서 타입을 undefined | number > number 로 바꾸어주어야 해요~
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.
앗 네 ..! 서버 api 타입 변경까지 pending 하겠습니다!!
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.
반영 완료했습니다!
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.
LGTM~ 머지하셔도 될 것 같습니다!
draft.isLiked = !previousPost.isLiked; | ||
draft.likeCount = newLikeCount; |
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.
아 한번 더 감싸서 오는 에러가 있었구나..!
잘 찾아냈네요 굿굿
🚩 관련 이슈
📸 스크린샷
-잘 작동되는 거 확인했습니다!
2024-10-09.10.01.45.mov