⚡ Bolt: [성능 향상] React Flow 검색 데이터 캐싱으로 불필요한 노드 렌더링 방지 - #657
Conversation
- React Flow 데이터 객체 변이로 인한 전체 렌더링 성능 문제 해결. - `WeakMap`을 사용하여 불필요한 `node.data` 할당 방지 및 객체 참조 식별 유지.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
React Flow에서 검색 강조 상태(isHighlighted/isDimmed) 반영 시 node.data의 reference identity가 불필요하게 바뀌어 대규모 그래프에서 리렌더링/GC 부담이 커지는 문제를, WeakMap 기반 캐싱으로 완화하는 성능 최적화 PR입니다.
Changes:
- 검색 상태가 바뀌지 않은 노드에 대해 동일한
data객체 참조를 재사용하도록WeakMap(searchDataCache)캐싱 로직 추가 - 검색 입력 시
nodes.map에서 생성되는 불필요한data객체 할당을 줄여 React Flow 커스텀 노드의React.memo효율을 유지 - Bolt 학습 문서에 React Flow 데이터 참조/렌더링 성능 관련 인사이트 추가
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/App.tsx | 검색 하이라이트 적용 시 node.data 파생 객체를 WeakMap으로 캐싱해 참조 안정성 유지 |
| .jules/bolt.md | React Flow 노드 데이터 변이/참조 변경이 렌더링 성능에 미치는 영향과 대응(WeakMap 캐시) 기록 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const searchDataCache = new WeakMap<object, any>(); |
💡 What:
React Flow에서 검색 시 강조 표시에 따라 노드 데이터를 변경할 때, 변경되지 않은 상태의 노드들에 대해서도 매번 새로운
data객체가 할당되어 전체 그래프가 불필요하게 렌더링되는 문제를 해결했습니다. 모듈 범위의WeakMap(searchDataCache)을 사용하여 원본node.data참조를 기반으로 장식된(decorated) 데이터를 캐시했습니다.🎯 Why:
검색 텍스트가 바뀔 때마다 모든 노드의 데이터를 매핑하고 새로운 객체를 반환하게 되면,
isHighlighted나isDimmed상태가 변하지 않은 수많은 노드들의 경우에도 식별자(reference identity)가 달라져 React Flow의 모든 Custom Node (React.memo적용 컴포넌트)들이 리렌더링됩니다. 큰 그래프에서는 심각한 프레임 드랍(60fps 이하)을 발생시킵니다.📊 Impact:
React.memo가 정상적으로 동작하여 프레임 드롭이 크게 줄어듭니다.🔬 Measurement:
큰 데이터베이스 모델 (노드 수백 개 이상)에서 좌측 패널 상단의 검색(Search) 창에 테이블 이름을 빠르게 입력할 때, 성능 탭에서 "React Flow Render" 시간이 얼마나 감소했는지 확인합니다. 최적화 후에는 실제로 상태가 바뀐 극소수의 노드만 렌더링됩니다.
PR created automatically by Jules for task 589112075250166055 started by @seonghobae