HumeAI / empathic-voice-api-js

Packages for using EVI with JavaScript, React, or as a Widget
https://empathic-voice-api-js-next-app.vercel.app
16 stars 10 forks source link

Functions in from useVoice are no longer stable between re-renders in @humeai/voice-react 0.1.15 #269

Closed michalmo closed 1 month ago

michalmo commented 1 month ago

Something in version 0.1.15 (probably #265) has changed the behaviour of the functions returned by the useVoice hook. The references returned are now changing with each render (so as often as fft changes).

Specifically in my code effects such as this are being called each render:

  const { readyState, sendUserInput } = useVoice();

  useEffect(() => {
    if (readyState === VoiceReadyState.OPEN) {
      sendUserInput(...);
    }
  }, [readyState, sendUserInput]);
yinishi commented 1 month ago

The fix is available in beta 0.1.16-beta.2 and will be included in the upcoming 0.1.16 release.