styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
MIT License
1.07k stars 139 forks source link

handle complex expressions inside CSS prop object syntax #359

Closed quantizor closed 2 years ago

quantizor commented 2 years ago

fixes #352

klarstrup commented 2 years ago

One of these changes broke my thing that isn't using the object syntax, I hope to find out more later but just an immediate FYI

quantizor commented 2 years ago

@klarstrup must be something to do with this change: https://github.com/styled-components/babel-plugin-styled-components/pull/359/files#diff-ef6a6ffba3d725918f184d76241892f9e7ac878aa3891cce860feea7648794b3L125

If you can come up with an example of the syntax that triggers the error, would appreciate it.

klarstrup commented 2 years ago

You'll have to excuse the cobbled together repro but here you see the problem at a glance:

v2.0.1 image

v2.0.0 image

klarstrup commented 2 years ago

So in short there's an issue of spread ...props disappearing when combined with css within a render prop (but this also happens if one copies out the render prop function into for example a useMemo)

klarstrup commented 2 years ago

fix is in btw https://github.com/styled-components/babel-plugin-styled-components/pull/361