Skip to content
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

FlexItem doesn't render children when used "as" another component #42380

Closed
tellthemachines opened this issue Jul 13, 2022 · 0 comments · Fixed by #42686
Closed

FlexItem doesn't render children when used "as" another component #42380

tellthemachines opened this issue Jul 13, 2022 · 0 comments · Fixed by #42686
Assignees
Labels
[Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Comments

@tellthemachines
Copy link
Contributor

Description

When using a FlexItem "as" a component that is expected to have children, the children of that component may not get rendered. This happens because in the useContextSystem hook, finalComponentProps.children is set even if there is no value for it, so the component FlexItem is rendering "as" receives an empty children prop, which may override its own children.

I came across this issue while trying to use FlexItem "as" an Icon in #42309.

Step-by-step reproduction instructions

  1. Try creating a FlexItem to render "as" an Icon, e.g. <FlexItem as={ Icon } icon={ positionCenter } />
  2. Verify that the Icon content (in this case, the path inside the svg element) isn't rendered.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@tellthemachines tellthemachines added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components labels Jul 13, 2022
@mirka mirka self-assigned this Jul 25, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 25, 2022
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants