[1팀 한아름] Chapter 4-2 코드 관점의 성능 최적화 - #25
Open
areumH wants to merge 15 commits into
Open
Conversation
This file contains hidden or 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
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.
과제 체크포인트
배포 링크
https://areumh.github.io/front_6th_chapter4-2/
과제 요구사항
배포 후 url 제출
API 호출 최적화(
Promise.all이해)SearchDialog 불필요한 연산 최적화
SearchDialog 불필요한 리렌더링 최적화
시간표 블록 드래그시 렌더링 최적화
시간표 블록 드롭시 렌더링 최적화
과제 셀프회고
✅ api 호출 최적화
lectureCache는 createLectureFetcher 내부에만 존재하는 클로저 캐시이며, api를 호출한 후 데이터를 저장한다. 최초 호출 이후에 또 호출하면 이를 즉시 반환하며 외부에서는 캐시에 접근할 수 없다. SearchDialog 컴포넌트 외부에 한 번만 생성하여 모달의 리렌더링에 관계 없이 캐시 유지가 가능하다.
모달을 열어보면 최초 한 번 열었을 때만 api를 호출하고, 그 이후엔 캐싱된 값을 사용하여 api를 호출하지 않는 걸 확인할 수 있다!
✅ SearchDialog 최적화
✅ 시간표 블록 드래그, 드롭 최적화
개별 시간표 내에서 강의 추가, 삭제, 수정(dnd) 등의 상태 변화가 일어날 때 전체 시간표 (scheduleMap)의 렌더링을 줄이기 위해선 개별 스케줄 상태를 만들어야 한다는 생각 밖에 떠오르지 않아
ScheduleTable컴포넌트 내에서 각 상태를 useState로 관리하도록 해주었다..기존에 setScheduleMap을 사용하던 handleDragEnd 함수는 ScheduleTable 컴포넌트 내에서 강의 수정에 사용되어야 하므로 ScheduleDndProvider 내부가 아닌, 인자로 받아서 연결하도록 수정했다.
기술적 성장
코드 품질
개별 시간표 상태 관리를 useState로 구현했는데, 상태 라이브러리 (jotai, zustand, store) 등을 사용하여 구현해볼걸 하는 생각이 든다. 과제를 진행했을 당시엔 과제로 제공된 ScheduleProvider와 개별 시간표 상태 관리를 함께 구현할 방법이 useState 밖에 떠오르지 않았다.. 현재는 setScheduleMap 함수가 시간표 복제, 삭제 기능에만 사용되고 있기 때문에 개선이 필요하다고 생각된다.
학습 효과 분석
과제 피드백
리뷰 받고 싶은 내용