Skip to content

Comments

Fix performance regressions and remove dead code#103

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/improve-some-stuff
Draft

Fix performance regressions and remove dead code#103
Copilot wants to merge 2 commits intomainfrom
copilot/improve-some-stuff

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Several performance issues and dead code paths identified across the video editor frontend.

Composition: fix runaway Redux dispatches

previousTime.current was never updated after dispatching setCurrentTime, so the threshold check always passed after the first crossing — dispatching on every frame (~30/s instead of only on meaningful changes).

dispatch(setCurrentTime(currentTimeInSeconds));
previousTime.current = currentTimeInSeconds; // was missing

Also moved fps declaration above useEffect (was referenced before declaration) and removed 6 unused imports.

VideoTimeline: prevent unnecessary re-renders

Split useAppSelector((state) => state.projectState) into individual field selectors. The component was re-rendering on every currentTime change (30fps) despite only needing mediaFiles, activeElement, activeElementIndex, and timelineZoom.

FfmpegRender: remove double file loading + dead code

  • A Promise.all loaded every media file into FFmpeg, but the results were never used — the loop below re-loaded them individually via wroteFiles cache. Removed the unused parallel load.
  • Removed shadowed wroteFiles declaration (outer one was dead).
  • Replaced console.log('No media files to render') with toast.error() for user visibility.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Fix previousTime.current not updated after dispatch in Composition.tsx
  (reduces Redux dispatches by ~73% during playback)
- Move fps declaration before useEffect for readability
- Clean up unused imports in Composition.tsx
- Split useAppSelector in VideoTimeline.tsx to select individual fields
  instead of entire state (prevents re-renders on unrelated state changes)
- Remove dead code in FfmpegRender.tsx: shadowed wroteFiles variable and
  unused parallel file loading (files were being loaded twice)
- Replace debug console.log with toast.error in FfmpegRender.tsx

Co-authored-by: Godzilla675 <131464726+Godzilla675@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve some functionality and performance Fix performance regressions and remove dead code Feb 13, 2026
Copilot AI requested a review from Godzilla675 February 13, 2026 20:59
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.

2 participants