OpenCut-app / OpenCut-app/OpenCut

[PERF] TimelineElement not wrapped in React.memo causes thousands of unnecessary re-renders

Open
#726 0 comments 0 reactions 0 assignees View on GitHub

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 in useMemo
  • getKeyframeIndicators() recalculates on every render for selected elements (line 245-255)

Fix

  1. Wrap TimelineElement with React.memo() with stable deps
  2. Memoize the track sort in timeline/index.tsx with useMemo
  3. Memoize keyframe indicator calculations

Files

  • apps/web/src/components/editor/panels/timeline/timeline-element.tsx:186-368
  • apps/web/src/components/editor/panels/timeline/index.tsx:428-440

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.