-
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
Fix/resume submission #97
base: main
Are you sure you want to change the base?
Conversation
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.
👍
export const filterObject = ( | ||
targetObject: object, | ||
predicate: (entry: [string, any]) => boolean, | ||
): object => { | ||
return Object.fromEntries(Object.entries(targetObject).filter(predicate)); | ||
}; |
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.
object
랑 any
둘다 안좋은 타입이라 이건 어때여
export const filterObject = ( | |
targetObject: object, | |
predicate: (entry: [string, any]) => boolean, | |
): object => { | |
return Object.fromEntries(Object.entries(targetObject).filter(predicate)); | |
}; | |
export const filterObject = <T extends Record<string, unknown>>( | |
targetObject: T, | |
predicate: (entry: [string, T[keyof T]]) => boolean, | |
): Partial<T> => { | |
return Object.fromEntries(Object.entries(targetObject).filter(predicate)); | |
}; |
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.
Object.fromEntries(targetObject)의 타입이 [string, unknown][]으로 떠서 [string, T[keyof T]][]랑 불일치 한다고 에러가 나는디, 반환값도 Record<string, unknown>으로 나와서 Partial랑 불일치한다고 나오고. 코드에는 문제 없으니 그냥 type assertion 해주면 되나? 다른 해결 방법 있나 해서...
아니면 type safe한 entry 함수를 만들어서 써야 하나?
타스 버전은 5.0.2임당
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.
@designDefined Object.entries
의 한계라 그냥 assertion 해줘야될듯 ㅜㅜ
const cachedQuestion = queryClient.getQueryData<{ | ||
items: ResumeQuestion[]; | ||
}>(questionQuery.queryKey); |
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.
오..
void queryClient.invalidateQueries(["user", "information"]); | ||
void queryClient.invalidateQueries(["user", "invitation"]); | ||
void queryClient.invalidateQueries(["resume", "answer"]); | ||
void queryClient.invalidateQueries(["recruiting", "detail"]); |
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.
- void 는 왜해주나요?!
- 얘도 Promise.all 해주면 좋을듯합니다!
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.
굿 반영했습니다~
onSuccess 콜백은 Promise 체이닝을 더 할 일이 없을 것 같은데 Promise.all을 해주는 이유는 무엇인가요? 뭔가 성능 관련된 차이가 있는 지 궁금...
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.
@designDefined 사실 지금은 아무 의미 없는 게 맞는데 써주면 나중에 좋은 practice가 될수있어서! mutate() 의 onSuccess 랑 useMutation 의 onSuccess를 둘다 써줬을 경우에 onSuccess가 프로미스를 반환하게 하면 실행 순서를 제어 가능
인데 그냥 무시해도 될듯.. ㅋㅋㅋㅋㅋㅋ
요약
태스크 URL
체크리스트
PR 전
머지 전
작업 목록
임시저장 시 일부만 작성되게
테스트 방법 (Optional)
기타 질문 및 공유 사항 (Optional)