Closed arondeparon closed 1 year ago
Patch coverage: 75.00
% and project coverage change: -0.35
:warning:
Comparison is base (
38a60e5
) 90.25% compared to head (2678bdc
) 89.91%.
:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@all-contributors please add @ArondeParon for code
@ArondeParon Thank you :)
@marekrozmus
I've put up a pull request to add @ArondeParon! :tada:
What
This pull requests adds a
React.isValidElement
check right before the trailing and leading elements are cloned.Why?
Without this, any child that is passed will automatically be cloned, even if it is not a valid React element. If that is the case, a fatal error will be thrown, breaking the entire application.
This pull request fixes that by simply returning the child as-is if it is not a React element.
Use cases?
I came across this issue because I want to conditionally show certain actions. Right now, it's impossible to do it like this:
If ONE of these conditions is false, I would expect the other element to still be rendered. This is not the case, because the returned
null
is seen as a child, which is subsequently cloned (causing an error).