Refactor(client): 트리뷰 파일 구조 리팩토링#257
Open
jm8468 wants to merge 14 commits into
Open
Conversation
- defaultEdgeOptions로 Edge의 기본 스타일 지정 - tree-custom-edge-label.tsx 삭제 - custom-edge로 이름 변경
- 매직넘버 상수화 - 변수명 변경 - Array.reduce() 로직 최적화 - 가독성 개선
외부로 export 되는 컴포넌트만 index.ts에 존재하도록 수정
- tree-custom-handle을 삭제하고 <Handle> 내부 attribute로 속성 제어 - (응집도) tree-memo-list와 tree-memo-list-node를 병합
- detail-modal과 tree-memo를 `tree-memo-list-node` 폴더 내로 이동 - TreeBaseMemoNode -> TreeMemoBaseNode 로 이름 변경
- modal/confirm-modal -> confirm-modal로 폴더 깊이 변경
- detail-modal에서 인터페이스를 import하는 방향으로 수정
- 응집도 면에서 함께 수정되는 파일을 같은 디렉토리에 두었어요.
jm8468
requested review from
jogpfls,
jyeon03 and
twossu
and removed request for
a team
July 3, 2026 09:11
🎨 Storybook 배포 완료PR 작성자: @jm8468 |
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.
📌 Summary
tree-view의Handle커스텀 스타일이 React Flow 기본 스타일에 밀려 적용되지 않던 문제를 해결하고, 그 과정에서 함께 발견된 폴더 구조/중복 코드/렌더링 이슈들을 정리했어요.📚 Tasks
Handle컴포넌트 스타일 우선순위 문제 해결tree-view폴더 구조 정리 및 파일 위치 재배치useSingleAndDoubleClick훅 위치 이동 및 언마운트 버그 수정🔍 Describe
TreeCustomHandle자식 컴포넌트 + 인라인 스타일로.react-flow__handle기본 스타일을 덮어쓰던 방식을 제거하고, vanilla-extractselectors로.내클래스.react-flow__handle결합 선택자를 만들어 명시도를 고정 확보하도록 변경했어요. 기존 방식은 CSS 로드 순서에 따라 적용 여부가 달라지는 불안정한 상태였어요.tree-base-memo-node→tree-memo-base-node등),tree-memo,detail-modal등을 실제 사용 범위에 맞게tree-memo-list-node하위로 재배치했어요.create-node-edge.ts와convert-memos-data.ts에 중복 정의돼 있던NodeEdgeTypes를 통합하고,detail-modal.tsx와tree-memo/apis/queries.ts에 각각 정의돼 있던SelectedMemoTypes인터페이스 중복을 정리했어요.useSingleAndDoubleClick훅: 유일한 소비처인tree-memo로 이동시켜 응집도를 높이고, 언마운트 시clickTimeout을 정리하지 않아 발생할 수 있던 setState-after-unmount 버그를useEffectcleanup으로 수정했어요.TreeMemo에서useDetailMemo기본값 객체가 매 렌더 새로 생성되던 부분을 모듈 상수로 호이스팅했어요.base노드만 있는 상태로fitView가 먼저 계산되고, 이후 데이터가 도착하면 나머지 노드들이 갑자기 나타나며 깜빡이던 문제를 수정했어요. 쿼리가 끝나기 전에는ReactFlow를 마운트하지 않도록 가드를 추가해, 완성된 노드 목록 기준으로fitView가 한 번만 계산되도록 했어요.파일 구조 변경
tree-view/component폴더에는 외부로 export 할 것만 남겨두었어요.tree-memo폴더는tree-view/components/tree-memo-list-node폴더에서만 사용되므로 내부로 옮겼어요.DetailModal컴포넌트는 현재 tree-view에서만 이용되어tree-view폴더 내부로 옮겼어요.DetailModal컴포넌트를 삭제하고 해당 JSX를tree-memo로 옮기는 작업은 나중에 명세가 나오고 진행하고자 해요.useSingleAndDoubleClick훅도 같은 이유로tree-view폴더 내부로 옮겼어요.👀 To Reviewer
파일 구조 변경
파일 구조 변경에 있어서는 함께 수정되는 파일을 같은 디렉토리에 두기 을 참조하면서 진행했어요.
그런데
Component폴더의 중첩이 심해져서 어떻게 하면 더 개선할 수 있을까요?또한,
tree-memo폴더 내의 api와 hooks 폴더도tree-view폴더 내부로 옮겨야 할 지 잘 모르겠어요.