feat: make fragment children always an array #26
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.
fragment children, like any other jsx, could be an array or the single child.
the problem is, that for fragments the
fiber.propsareprops.children(same happens for arrays). and we are using thesefiber.propsas a key in WeakMaps (props to fiber(s) mapping for example) and it won't work if the single child of a fragment is a primitive (like a string).** in next PR we will also use this for the
__propsToSourcemap.we also update the
isStaticarg in this case.this flag actually means "is static children array" so it is false for a single child but we need it to be true when we wrap this single child in an array.
in all other cases we leave it as is.