wavesurfer-react
wavesurfer-react copied to clipboard
Fix infinite rerendering bug when plugins array is provided
<WavesurferPlayer
height={100}
waveColor={waveColor}
url={audioUrls[urlIndex]}
onReady={(ws) => setWavesurfer(ws)}
onPlay={() => setIsPlaying(true)}
onPause={() => setIsPlaying(false)}
plugins={[]}
/>
When plugins array is provided like above (whether empty or not), useEffect in useWavesurferInstance causes infinite rerendering.
Fixed this bug by serializing the options instead of flattening them.