-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] Update max number of listeners on stateChange event for CallAdapter #5660
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Storybook 8 URL https://60c7ae6891f0e90039d7cd54-hwyozbjuak.chromatic.com/ |
JamesBurnside
approved these changes
Feb 21, 2025
packages/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.ts
Outdated
Show resolved
Hide resolved
@azure/communication-react jest test coverage for stable.
|
@azure/communication-react jest test coverage for beta.
|
edwardlee-msft
approved these changes
Feb 21, 2025
Chat bundle size is not changed.
|
CallWithChat bundle size is not changed.
|
Calling bundle size is not changed.
|
Storybook 8 URL https://60c7ae6891f0e90039d7cd54-sadkwqpwpa.chromatic.com/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Updates the max number of event listeners that can be applied to an event.
Why
The warning that we were seeing was sepcifically caused by the max number of event subscriptions on the
'stateChanged'
event for the adapter. This was previously set to50
as the max.Recently we started making changes to how we were getting data from the state of the adapter by writing selectors for all of the data that we would be retrieving. This is what sent us over the limit. when we call


useSelector
like sothis under the hood calls a special hook for the adapter called
useAdaptedSelector
. in this hook we have a useEffect defined as followsfor every render that would go by all of the different selectors would unmount, removing listeners from the event. Then when the components of the composite would all go requesting their data again if the state changed causing the count of subscriptions to go up.
From testing the cap that we would see for the listeners on this event would be just over 100. ivestigating into the usage of

useSelector
in the CallComposite the number is94
usages of the hook.Since Typescript is linear we would see subscriptions to the event from different selectors around the composite before they were all cleaned up so we see the number of subscriptions going a little higher than 100 but they are always cleaned up down to a much smaller number.
Suggesting we bump the number of subscriptions here to give us a little more room to write more selectors in the CallComposite without causing the warning to come back.
https://skype.visualstudio.com/SPOOL/_workitems/edit/3964503
How Tested
Validated and investigated locally