π 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
- Upload a video
- Adjust audio settings (music file, volume, loop, etc.)
- Trigger export
- 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]
π Location
src/hooks/useVideoEditor.ts (around line 334)
β Bug Description
The
handleExportfunction is wrapped in auseCallbackhook but does not include all the required dependencies in its dependency array.The function internally uses:
musicFilemusicVolumeoriginalAudioVolumeloopMusicHowever, these variables are missing from the dependency array, which can lead to stale closures and outdated values being used during export.
π Steps to Reproduce
β Expected Behavior
The export function should always use the latest updated values for all audio-related settings.
Due to missing dependencies,
handleExportmay use stale values, leading to incorrect export behavior.π₯ Impact
π‘ Proposed Fix
Update the dependency array of
useCallbackto include all referenced variables: