-
Notifications
You must be signed in to change notification settings - Fork 4
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
[선물 등록, 선물방 편집] 리액트 쿼리 관련 데이터 실시간 업데이트 문제 해결 #339
Changes from all commits
ef051b1
eecca9b
219d1ba
b4c3dd9
bc956ab
9aea10d
2f7ad8c
5767ebe
18f521c
4fc2257
68b0d75
1417570
6c0f4da
f2734fd
1ac0523
9338381
984bc3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import * as S from './GiftAddNextBtn.styled'; | |
interface GiftAddNextBtnProps { | ||
children: React.ReactNode; | ||
isActivated: boolean; | ||
onClick: () => void; | ||
onClick: VoidFunction; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오오 !!!! 매우매우 굳입니다 ㅎㅎㅎ 이거 그때 합숙때 알게 된 것이군요 !! 저도 반영해야겠어요😊 |
||
} | ||
const GiftAddNextBtn = ({ children, isActivated, onClick }: GiftAddNextBtnProps) => { | ||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,14 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; | |
import { del } from '../../../apis/client'; | ||
import { MY_GIFT_QUERY_KEY } from './useGetMyGift'; | ||
|
||
export const deleteMyGift = async (giftId: number) => { | ||
export async function deleteMyGift(giftId: number) { | ||
await del(`/gift/my/${giftId}`); | ||
}; | ||
} | ||
|
||
export const useDeleteMyGift = (roomId: number) => { | ||
const queryClient = useQueryClient(); | ||
|
||
const mutation = useMutation({ | ||
mutationKey: [MY_GIFT_QUERY_KEY[0]], | ||
mutationFn: deleteMyGift, | ||
onSuccess() { | ||
console.log('선물 삭제 성공'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mutationKey 제거 대박 너무 좋아요!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 대박.. 이 리뷰 너무너무 좋아요 이렇게 3가지 방식이 있고, 저희는 3번째 방식으로 진행하고 있다는 사실이 이해가 쏙쏙 된거 같습니다 !!!!! 너무너무 감사해요 너무너무 좋아요 !!!!!!!! There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
흠.. 뭔가 이 객체를 따로 관리 할 수 있는 방법이 없을까요 ??? 상수화 하여 가독성이 좋아지도록이요!! 이렇게 직접적으로 드러내는게 더 좋은 것 같다면 그것도 오케이인데, if 부분과 else 부분 모두 이 코드가 중복 되어지는거 같아서요!!
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.
조건문의 경우 presignedUrl을 막으면서 임시로 추가된 것이어서 다른 이슈 해결하면서 중복 제거했습니다! 말씀해주신 대로 상수화를 통해 가독성을 개선하면 훨씬 좋을 것 같네요 감사합니다🥰 context 브랜치에서 상수화 가능할 것 같아서 다른 PR에서 적용해보겠습니다:)