-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/fe-040 먹팟 상세 페이지 #52
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
오 react query 관련 리팩터링을 했군요! 동기가 매우 공감됩니다~👍 |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
커스텀한 useMutation 하고 폴더 구조 공통화 시키면 좋을것같아요~ 회의 잡아서 따로 말해보아요 �👍🏼 |
jieunpark247
approved these changes
Jun 30, 2023
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.
👍🏼
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
체크 리스트
작업 내역
상세 페이지 기능 구현
문제 상황과 해결
쿼리키 하드코딩 문제 해결
위와 같이 단순 배열 하드코딩으로 관리되고 있어서 휴먼에러 발생 가능성이 높은 상황
쿼리 관련 폴더구조 및 쿼리키 관리 기능 추가
문제사항1 - 난해한 쿼리 관련 폴더구조
queryKey
따로,queryFn
따로,queryHook
을 다 따로 보관되어버린다.문제사항2 - API 데이터 타입들이 모두 흩어져 있었음
types
로 만들어서 관리했으나 이 역시 여기저기 타입이 흩어지면서 관리 및 사용이 너무 어려워짐해결 방법 - 하나의 폴더로 관심사 통합하기
쿼리 별로 (
board
,user
)queryKey
,queryFn
,queryHook
(+ 관련 타입)을 묶어서 하나의 상위 폴더 내 에서 관리하도록 함커스텀
useMutation
훅 정의일반
tanstackquery
의useMutation
훅을 사용할 경우 에러에 대한 타입유추가 제대로 되지 않아서 덮어쓰는 함수 정의커스텀
useMutation
을 쓸 경우 위와 같이 에러 타입에 대한 유추가 정상적으로 작동비고
나중에 해야될 일 : 게시글 수정 페이지로 연결