Ternary sx
statement with undefined
causes component unmount/remount
#2164
Labels
bug
Something isn't working
Describe the bug
Let's say I have a basic React component:
And then I use
sx
on that component, swapping between an object andundefined
based on some state:This causes the
Test
component to unmount/remount (along with any children it renders).This is because when the
sx
prop is defined,Test
is rendered insideEmotionCssPropInternal
and when it's undefined, it's rendered on its own.I don't believe this is the case when using emotion's
css
prop.Expected behavior
EmotionCssPropInternal
should wrap any component that usessx
prop, even if that prop value isundefined
.The text was updated successfully, but these errors were encountered: