Skip to content

Commit b069dcc

Browse files
authored
Merge branch 'main' into alkwa/update-calling-1.33.3
2 parents 89141d6 + ee694fe commit b069dcc

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Bugs",
5+
"comment": "update the max number of listeners that the CallWIthChat adapter has",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Bugs",
5+
"comment": "update the max number of listeners that the CallWIthChat adapter has",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}

packages/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,21 @@ import { busyWait } from '../../common/utils';
113113

114114
type CallWithChatAdapterStateChangedHandler = (newState: CallWithChatAdapterState) => void;
115115

116+
/**
117+
* For each time that we use the hook {@link useSelector} in the {@link CallWithChatComposite} we add another listener
118+
* to the `stateChanged` event on the this adapter. This number is set in relation to the number of
119+
* times that we are using the hook useSelector in the CallComposite.
120+
*
121+
* We will need to update this as the threshold is reached with more usages of useSelector.
122+
*/
123+
const MAX_EVENT_LISTENERS = 125;
124+
116125
/** Context of Call with Chat, which is a centralized context for all state updates */
117126
class CallWithChatContext {
118127
private emitter = new EventEmitter();
119128
private state: CallWithChatAdapterState;
120129

121-
constructor(clientState: CallWithChatAdapterState, maxListeners = 50) {
130+
constructor(clientState: CallWithChatAdapterState, maxListeners = MAX_EVENT_LISTENERS) {
122131
this.state = clientState;
123132
this.emitter.setMaxListeners(maxListeners);
124133
}

0 commit comments

Comments
 (0)