bugfix(react-jsx-runtime): static children problem on render function#29162
Merged
bsunderhus merged 1 commit intoSep 20, 2023
Merged
Conversation
bsunderhus
marked this pull request as ready for review
September 18, 2023 13:00
bsunderhus
marked this pull request as draft
September 18, 2023 13:01
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e69ef0c:
|
Collaborator
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 921694374c78c37ecf18d7bb99000bb0bb67551b (build) |
Collaborator
🕵 fluentuiv9 No visual regressions between this PR and main |
bsunderhus
force-pushed
the
react-jsx-runtime/fix--29144
branch
from
September 19, 2023 08:36
16b07fe to
a52ffbb
Compare
Collaborator
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Button | mount | 316 | 319 | 5000 | Possible regression |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 70 | 82 | 10 | Possible regression |
| InfoButton | mount | 14 | 14 | 5000 | Possible regression |
| SpinButton | mount | 1448 | 1361 | 5000 | Possible regression |
All results
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 628 | 598 | 5000 | |
| Button | mount | 316 | 319 | 5000 | Possible regression |
| Field | mount | 1153 | 1079 | 5000 | |
| FluentProvider | mount | 706 | 683 | 5000 | |
| FluentProviderWithTheme | mount | 85 | 85 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 67 | 74 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 70 | 82 | 10 | Possible regression |
| InfoButton | mount | 14 | 14 | 5000 | Possible regression |
| MakeStyles | mount | 836 | 860 | 50000 | |
| Persona | mount | 1720 | 1667 | 5000 | |
| SpinButton | mount | 1448 | 1361 | 5000 | Possible regression |
bsunderhus
force-pushed
the
react-jsx-runtime/fix--29144
branch
5 times, most recently
from
September 19, 2023 13:43
a3a51f7 to
742d4bc
Compare
bsunderhus
marked this pull request as ready for review
September 19, 2023 13:43
bsunderhus
force-pushed
the
react-jsx-runtime/fix--29144
branch
from
September 19, 2023 13:45
742d4bc to
6d0510d
Compare
ling1726
reviewed
Sep 19, 2023
ling1726
reviewed
Sep 19, 2023
ling1726
reviewed
Sep 19, 2023
bsunderhus
force-pushed
the
react-jsx-runtime/fix--29144
branch
from
September 20, 2023 07:15
56c4abf to
e69ef0c
Compare
ling1726
approved these changes
Sep 20, 2023
| />, | ||
| ); | ||
|
|
||
| // your test code here |
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.

New Behavior
The new React jsx runtime splits the creation of a jsx element into 2, one for static elements and one for dynamic elements.
A static element is an element with a well defined amount of unkeyed children (above one), unkeyed chldren means a set of children where their position does not change, something like these:
in this case on the newest react runtime this will be transpiled to something like:
Notice that the first
parentdiv is rendered by invoking ajsxsmethod meanwhile all it's children are rendered by ajsxmethod.A static element will always have as it's children an array of unkeyed content. A dynamic element on the other hand cannot understand an array of unkeyed content.
The problem issued on #29144 shows that on a render function of the
buttonslot we're dealing with a case where a static element children is being passed down to a dynamic element.This PR solves this by wrapping this children around a single static fragment and then passing it down as the children of the render function, that way the render function (which will probably be a dynamic render) can easily render the children again as either a static or a dynamic content.
Related Issue(s)