Skip to content

[BUG] Missing dependencies in useCallback causing stale state in handleExpoΒ #787

@Hrithik-ui753

Description

@Hrithik-ui753

πŸ“ Location

src/hooks/useVideoEditor.ts (around line 334)


❌ Bug Description

The handleExport function is wrapped in a useCallback hook but does not include all the required dependencies in its dependency array.

The function internally uses:

  • musicFile
  • musicVolume
  • originalAudioVolume
  • loopMusic

However, these variables are missing from the dependency array, which can lead to stale closures and outdated values being used during export.


πŸ” Steps to Reproduce

  1. Upload a video
  2. Adjust audio settings (music file, volume, loop, etc.)
  3. Trigger export
  4. Observe that changes are not always reflected correctly

βœ… Expected Behavior

The export function should always use the latest updated values for all audio-related settings.


⚠️ Actual Behavior

Due to missing dependencies, handleExport may use stale values, leading to incorrect export behavior.


πŸ’₯ Impact

  • Incorrect export output
  • Audio settings not applied properly
  • Hard-to-debug state issues

πŸ’‘ Proposed Fix

Update the dependency array of useCallback to include all referenced variables:

[musicFile, musicVolume, originalAudioVolume, loopMusic]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctlytype:bugBug fix

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions