Mark Text dirty when descendant Text updates occur #11008
Merged
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.
Description
Type of Change
Erase all that don't apply.
Why
Text should be marked dirty when descendant text nodes are added or removed, and Text should also be marked dirty when descendants of descendant virtual text nodes have changes to their text content.
Resolves #11007
What
This change ensures that the Yoga node for Text is appropriately updated when these types of changes occur.
Please note, this is likely to create a slight performance regression for apps that modify nested text content after initial mount, as these changes previously would not trigger text measurement, and now they will. But it's worthwhile to trade correctness for a minor performance benefit.
Testing
Ran a test in simple.tsx:
Text is now remeasured when descendant virtual or raw text is updated:
React.Native.Playground.Win32.2022-12-13.12-46-20.mp4
Here is the before:
React.Native.Playground.Win32.2022-12-13.13-24-40.mp4
Microsoft Reviewers: Open in CodeFlow