Merged
Conversation
E0min
approved these changes
Sep 17, 2025
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.
PR 요약
본 PR은 D3 그래프 컴포넌트에서 발견된 두 가지 주요 문제를 해결합니다.
이를 통해 컴포넌트의 성능과 사용자 경험(UX)을 개선하고자 합니다.
주요 변경 사항
1.
useMemo와useCallback을 이용한 렌더링 성능 최적화문제점 (AS-IS)
useQuestionTree훅이 리렌더링될 때마다 새로운 함수(onNodeClick등)와 객체(viewData등) 참조를 생성했습니다.props로 이 값들을 받는InteractiveD3Graph컴포넌트가 내용 변경이 없음에도 불구하고 불필요하게 전체를 다시 그리는 현상이 발생하여, 그래프가 깜빡이는 것처럼 보였습니다.해결책 (TO-BE)
useQuestionTree훅 내부에useCallback과useMemo를 적용하여, 반환되는 함수와 값들의 참조 안정성을 보장했습니다.props가 실제로 변경될 때만 그래프가 업데이트되도록 하여, 불필요한 렌더링과 깜빡임 현상을 완전히 해결했습니다.2. 노드 클릭 시 스타일링 로직 개선
문제점 (AS-IS)
fill(채우기) 색상은 그대로 둔 채, 두꺼운 파란색stroke(테두리)만 추가로 적용했습니다.해결책 (TO-BE)
currentPath라는 단일 상태에만 의존하도록 통합했습니다.currentPath상태만 변경시키는 트리거 역할을 합니다.currentPath를 기반으로 '현재 활성화된 노드'와 '경로상의 노드', '일반 노드'를 명확히 구분하여fill색상을 일관되게 적용하도록 수정했습니다.관련 이슈