fix: replace useState with useRef for preview primitive to prevent memory leak
The preview primitive in SpanAnnotationManager was stored in useState, causing unnecessary re-renders and potential memory leaks since the primitive was not cleaned up on unmount. Changed to useRef, updated all read/write sites, removed from dependency arrays, and added unmount cleanup effect that detaches the primitive from the series. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e5b0cc2540
commit
0cd7a34c99
2 changed files with 35 additions and 21 deletions
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
## 8. Frontend — Memory Leaks & Performance
|
||||
|
||||
- [ ] 8.1 `[opus]` Fix SpanAnnotationManager preview primitive memory leak: replace `useState` with `useRef` for preview primitive, add cleanup on unmount (`src/components/SpanAnnotationManager.tsx:265-324`)
|
||||
- [x] 8.1 `[opus]` Fix SpanAnnotationManager preview primitive memory leak: replace `useState` with `useRef` for preview primitive, add cleanup on unmount (`src/components/SpanAnnotationManager.tsx:265-324`)
|
||||
- [ ] 8.2 `[sonnet]` Use `chart.applyOptions()` for theme changes instead of re-creating chart (`src/components/CandleChart.tsx:333`)
|
||||
- [ ] 8.3 `[sonnet]` Remove `fitContent()` from reconciliation effect, only call on initial load (`src/components/SpanAnnotationManager.tsx:160`)
|
||||
- [ ] 8.4 `[opus]` Implement incremental primitive updates in SpanAnnotationManager: update only selection state on selection change, full reconciliation only on annotation list changes (`src/components/SpanAnnotationManager.tsx:104-161`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue