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

Fix/resume submission #97

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix/resume submission #97

wants to merge 2 commits into from

Conversation

designDefined
Copy link
Collaborator

요약

  • 마감 기한: YY-MM-DD
  • 상태:

태스크 URL

체크리스트

PR 전

  • 칸반 생성
  • pre-commit 성공
  • type-label 추가

머지 전

  • 칸반 옮기기
  • 코멘트 리졸브
  • squash & merge

작업 목록

임시저장 시 일부만 작성되게

테스트 방법 (Optional)

기타 질문 및 공유 사항 (Optional)

@designDefined designDefined added the enhancement New feature or request label Aug 10, 2023
Copy link
Member

@woohm402 woohm402 left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines +1 to +6
export const filterObject = (
targetObject: object,
predicate: (entry: [string, any]) => boolean,
): object => {
return Object.fromEntries(Object.entries(targetObject).filter(predicate));
};
Copy link
Member

Choose a reason for hiding this comment

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

objectany 둘다 안좋은 타입이라 이건 어때여

Suggested change
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));
};

Copy link
Collaborator Author

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임당

Copy link
Member

Choose a reason for hiding this comment

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

@designDefined Object.entries 의 한계라 그냥 assertion 해줘야될듯 ㅜㅜ

Comment on lines +33 to +35
const cachedQuestion = queryClient.getQueryData<{
items: ResumeQuestion[];
}>(questionQuery.queryKey);
Copy link
Member

Choose a reason for hiding this comment

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

오..

Comment on lines +182 to +185
void queryClient.invalidateQueries(["user", "information"]);
void queryClient.invalidateQueries(["user", "invitation"]);
void queryClient.invalidateQueries(["resume", "answer"]);
void queryClient.invalidateQueries(["recruiting", "detail"]);
Copy link
Member

Choose a reason for hiding this comment

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

  1. void 는 왜해주나요?!
  2. 얘도 Promise.all 해주면 좋을듯합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

굿 반영했습니다~
onSuccess 콜백은 Promise 체이닝을 더 할 일이 없을 것 같은데 Promise.all을 해주는 이유는 무엇인가요? 뭔가 성능 관련된 차이가 있는 지 궁금...

Copy link
Member

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가 프로미스를 반환하게 하면 실행 순서를 제어 가능

인데 그냥 무시해도 될듯.. ㅋㅋㅋㅋㅋㅋ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants