Mitigate chat re-rerenders in callwithchat composite#4301
Merged
JamesBurnside merged 6 commits intomainfrom Mar 19, 2024
Merged
Mitigate chat re-rerenders in callwithchat composite#4301JamesBurnside merged 6 commits intomainfrom
JamesBurnside merged 6 commits intomainfrom
Conversation
Contributor
Contributor
CallWithChat bundle size is increased❗.
|
Contributor
Chat bundle size is increased❗.
|
Contributor
Calling bundle size is increased❗.
|
Contributor
@azure/communication-react jest test coverage for beta.
|
Contributor
@azure/communication-react jest test coverage for stable.
|
| let fluentV8Theme: Theme = mergeThemes(defaultTheme, fluentTheme); | ||
| fluentV8Theme = mergeThemes(fluentV8Theme, { rtl }); | ||
| const fluentV8Theme = useMemo(() => { | ||
| const mergedTheme = mergeThemes(defaultTheme, fluentTheme); |
vhuseinova-msft
approved these changes
Mar 19, 2024
dmceachernmsft
approved these changes
Mar 19, 2024
Contributor
This file contains hidden or 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
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
Ensure theme is memoized when it is merged
Why
useThemeto always return a new valueExtra Notes
This is a needed fix but only a mitigation to the problem. The underlying problem is that whenever any of these dependencies change in the
onRenderChatContentmemoization, it causes the entire chat composite to unmount and then remount. It shouldn't do this. It should trigger a re-render, but react should correctly reconcile that this is not a new component, but the same as the old component but with new props. Because react is not reconciling the new anonymous function with the existing one, it replaces the entire react component (causing unmount of the existing chat composite and remount of a new chat composite). Why this is happening is still under investigation but this change is a net good change regardless.Bug this is mitigating for more information: https://skype.visualstudio.com/SPOOL/_workitems/edit/3557255
How Tested
Locally verified the re-rerenders aren't triggering in the repro scenario.