react-wavesurfer icon indicating copy to clipboard operation
react-wavesurfer copied to clipboard

[v2] Infinite loop when audioFile prop changes

Open ArTiSTiX opened this issue 8 years ago • 0 comments

https://github.com/mspae/react-wavesurfer/blob/480ce7bf7391a3326ff7c534e757b07a1f286dfb/src/react-wavesurfer.tsx#L236-L242

HookupEvents receives props at init, and creates a callback on('ready') calling updateProps(props), which refers to initialProps.

Thus, changing audio files triggers a new ready event, rolling back some props and creating an infinite loop.

Why is it necessary to trigger an updateProps and forceUpdate after ready ? (Commenting updateProps solves the infinite loop, but there must be a side effect i didn't find).

ArTiSTiX avatar Jan 12 '18 10:01 ArTiSTiX