OpenCut-app / OpenCut-app/OpenCut
[PERF] TimelineElement not wrapped in React.memo causes thousands of unnecessary re-renders
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 89.8k
- Forks
- 8.9k
- PR merge metrics
- No merged PRs in 30d
Description
Description
apps/web/src/components/editor/panels/timeline/timeline-element.tsx is NOT wrapped in React.memo(). This is the most performance-critical component in the editor - it renders for every clip on the timeline.
Impact
Every playhead update triggers re-render of ALL visible timeline elements. With 100 tracks and 50+ elements each, this causes 5000+ unnecessary renders per update.
Additional Issues in Same Area
- Track array is cloned and sorted on every render in
timeline/index.tsx:428-440— should be wrapped inuseMemo getKeyframeIndicators()recalculates on every render for selected elements (line 245-255)
Fix
- Wrap
TimelineElementwithReact.memo()with stable deps - Memoize the track sort in
timeline/index.tsxwithuseMemo - Memoize keyframe indicator calculations
Files
apps/web/src/components/editor/panels/timeline/timeline-element.tsx:186-368apps/web/src/components/editor/panels/timeline/index.tsx:428-440
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/web/src/components/editor/panels/timeline/timeline-element.tsx:186-368 and apps/web/src/components/editor/panels/timeline/index.tsx:428-440. Inspect the component updates, track sorting, and getKeyframeIndicators() calculations, then verify that TimelineElement is memoized and the listed work is complete without changing timeline behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100