-
Notifications
You must be signed in to change notification settings - Fork 167
Description
What happened and what did you expect to happen?
If the device passed to addVoiceFocus is an empty string, the function still calls:
const vf = await transformer?.createTransformDevice(device);
if (vf) {
logger.info('Created a new Amazon Voice Focus transform device.');
setVoiceFocusDevice(vf);
return vf;
}This causes vf to be created and subsequently setVoiceFocusDevice(vf) is invoked, which leads to a new reference for addVoiceFocus on every render.
If addVoiceFocus is called inside an effect and included as a dependency, this results in an infinite rerender.
2025-10-20.18-08-47.mov
Recommendation:
- Add an early exit: don’t call transform if device is empty.
- Memoize addVoiceFocus so its reference remains stable when device doesn’t change.
Have you reviewed our existing documentation?
- Amazon Chime SDK for JavaScript GitHub issues
- Amazon Chime SDK React Components Library GitHub issues
- Storybook documentation
- README page
- React SDK meeting demo
Reproduction steps
Steps to Reproduce:
- Call
addVoiceFocuswith an empty string as the device. - Observe that
createTransformDeviceis invoked. - Include
addVoiceFocusin a React effect dependency array. - Notice infinite rerendering.
Amazon Chime SDK React Components Library version
^3.11.0
What browsers are you seeing the problem on?
Chrome dev, comet
Browser version
Version 143.0.7475.7
Device Information
MacBook Pro; 14.1 (23B74)
Meeting and Attendee ID Information.
No response
Browser console logs
ConsoleLogger.js:79 2025-10-20T10:23:57.861Z [INFO] ChimeSDKReactComponent - Created a new Amazon Voice Focus transform device.
ConsoleLogger.js:79 2025-10-20T10:23:58.083Z [INFO] ChimeSDKReactComponent - Created a new Amazon Voice Focus transform device.
ConsoleLogger.js:79 2025-10-20T10:23:58.339Z [INFO] ChimeSDKReactComponent - Created a new Amazon Voice Focus transform device.
ConsoleLogger.js:79 2025-10-20T10:23:58.879Z [INFO] ChimeSDKReactComponent - Created a new Amazon Voice Focus transform device.
ConsoleLogger.js:79 2025-10-20T10:23:59.029Z [INFO] ChimeSDKReactComponent - Created a new Amazon Voice Focus transform device.
Add any other context about the problem here.
No response