-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor: 서버 데이터 이름 구체화 #164
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
Conversation
- data, isLoading, refetch -> 구체적인 이름으로 변경
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
src/apis/manager.ts
Outdated
| }; | ||
|
|
||
| export const readReportDetail = async (reportId: number): Promise<Report> => { | ||
| export const readOneReport = async (reportId: number): Promise<Report> => { |
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.
One을 강조하신 이유가 있으실까요? 있다면 상관없지만 없다면 readRepord라고 해도 괜찮을 것 같습니다.
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.
좋은 의견입니다!
src/pages/Admin/CreateGroup/Page.tsx
Outdated
| data: studyEnrolleesData, | ||
| refetch: studyEnrolleesRefetch, | ||
| isLoading: isStudyEnrolleesLoading, | ||
| } = useQuery(['readEnrollees'], readEnrollees, { |
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.
studyEnrollees와 그냥 enrollee가 함께 사용되고 있는데, 도메인이 스터디이기 때문에 enrollee로 통일하는 것은 어떻게 생각하시나요?
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.
studyEnrollee가 더 구체적인 것 같고, 현재 enrollee 보다 studyEnrollee가 더 많이 사용되고 있습니다.
studyEnrollee로 통일하는 걸로 하겠습니다!
src/pages/StudyEnrollment/Page.tsx
Outdated
| export default function StudyEnrollmentPage() { | ||
| const { data: myStudyEnrollment, isLoading } = useQuery('getMyStudyEnrollment', getMyGroup); | ||
| export default function StudyApplicationPage() { | ||
| const { data: myStudyEnrollment, isLoading: isMyStudyEnrollmentLoading } = useQuery( |
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.
| const { data: myStudyEnrollment, isLoading: isMyStudyEnrollmentLoading } = useQuery( | |
| const { data: myStudyEnrollmentData, isLoading: isMyStudyEnrollmentLoading } = useQuery( |
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.
반영하였습니다.
| const [debouncedSearchTerm] = useDebounce(searchTerm, 250); | ||
|
|
||
| const { data: searchResults } = useQuery(['searchCourse', debouncedSearchTerm], () => | ||
| const { data: searchCourseResults } = useQuery(['searchCourse', debouncedSearchTerm], () => |
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.
| const { data: searchCourseResults } = useQuery(['searchCourse', debouncedSearchTerm], () => | |
| const { data: searchCourseResultsData } = useQuery(['searchCourse', debouncedSearchTerm], () => |
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.
꼼꼼하게 봐주셨군요. 반영하였습니다.
- 변수명 통일 및 구체화
|
@ohinhyuk 님, 고생 많으셨습니다! 자잘한 코드 수정이긴 하지만 전체적으로 통일성은 높아진 것 같습니다!ㅎㅎ |
작업 사항
기존에 서버에서 가져온 데이터 이름을 대부분 data (default 값)으로 사용함.
이름이 구체적이지 않아 코드 상에서 어떤 데이터인지 파악이 어려움.
데이터의 주제에 맞는 데이터 명으로 구체화하여 코드 가독성을 증가시킨다.
추가로 isLoading, refetch도 해당 주제에 맞게 구체화 함.
작업 단계
리팩터링 할 때, 기존 서버 호출이 잘 유지 되는 지 확인할 수 있어야 함.
따라서 페이지 접근 후 화면이 잘 출력되는 지 확인하는 테스트 코드들을 작성함
e2e-test/pages/*/page.spec.ts서버에서 가져온 data, isLoading, refetch 모두 주제에 맞는 이름으로 구체화
Example
AS-IS
TO-BE
관련 이슈
close #161