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
Ternary sx
statement with undefined
causes component unmount/remount
#2164
Comments
Appreciate the report! Is this causing issues in your project? Or more like a "oh that's funky" that's not meaningfully slowing it down? |
I had been initially conflicted about handling For now, could you an empty object |
Yes, I am using |
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: