Skip to content

perf(toc): 역순 탐색 조기 종료 및 불필요한 getBoundingClientRect 호출 제거 - #89

Merged
CoBool merged 2 commits into
mainfrom
refactor/toc-active-heading-scroll-spy
Aug 16, 2026
Merged

perf(toc): 역순 탐색 조기 종료 및 불필요한 getBoundingClientRect 호출 제거#89
CoBool merged 2 commits into
mainfrom
refactor/toc-active-heading-scroll-spy

Conversation

@CoBool

@CoBool CoBool commented Aug 16, 2026

Copy link
Copy Markdown
Owner
  • useActiveHeading에서 헤딩 목록을 역순(Bottom-up)으로 탐색하여 활성선 기준점(0.35) 이하의 첫 헤딩 발견 시 즉시 조기 종료(break) 적용
  • 긴 포스트 스크롤 시 상단 헤딩들에 대한 불필요한 getBoundingClientRect()(강제 Reflow) 반복 호출 방지
  • 동일 ID 상태 변경 방지 가드 추가로 불필요한 리렌더링 억제
  • 조기 종료 동작을 검증하는 단위 테스트(tests/use-active-heading.test.tsx) 추가
  • 전체 32개 테스트 파일 / 223개 테스트 100% 통과

CoBool added 2 commits August 16, 2026 20:37
- useActiveHeading에서 헤딩 목록을 역순(Bottom-up)으로 탐색하여 활성선 기준점 이하의 첫 헤딩 발견 시 즉시 조기 종료(Early-break) 적용

- 긴 포스트 스크롤 시 상단 헤딩들의 불필요한 DOM 측정(Reflow) 방지

- 동일 ID 상태 변경 방지 가드 추가 및 조기 종료 동작 검증 단위 테스트 추가
@CoBool
CoBool merged commit bb1f576 into main Aug 16, 2026
1 check passed
@CoBool
CoBool deleted the refactor/toc-active-heading-scroll-spy branch August 16, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant