Current behavior:
Previously emotion would filter out invalid css rules e.g. background-color: ${undefined} would return nothing and get filtered out.
To reproduce:
https://codesandbox.io/s/emotion-issue-template-forked-4qi2s
Expected behavior:
invalid rules should be removed/filtered
Environment information:
emotion 11
Additional Notes:
The goal is an elegant solution to conditional css rules. The alternative to not hiding invalid rules is very messy:
h1 {
${props => props.color && (
css`
color: ${props.color};
`)}
}
As a workaround object styles can be used: https://codesandbox.io/s/emotion-issue-template-forked-f8fs2?file=/src/index.js
Note to myself: this has changed between Stylis 3 and 4. I'll give this a thought if we should align with the old behavior.
The PR to stylis that is fixing this has been merged in - hopefully it will get released shortly
Most helpful comment
As a workaround object styles can be used: https://codesandbox.io/s/emotion-issue-template-forked-f8fs2?file=/src/index.js
Note to myself: this has changed between Stylis 3 and 4. I'll give this a thought if we should align with the old behavior.