Skip to content
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

Usage of css prop broken in 1.13.2 #352

Closed
jbanulso opened this issue Sep 2, 2021 · 5 comments · Fixed by #359
Closed

Usage of css prop broken in 1.13.2 #352

jbanulso opened this issue Sep 2, 2021 · 5 comments · Fixed by #359

Comments

@jbanulso
Copy link

jbanulso commented Sep 2, 2021

Hi,

Upgrading this library from v1.12.0 to v1.13.2 is breaking my app builds. I've pinned it down to a specific component that it's using the css prop as follows:

const MyComponent = ({ width, ...props }) => {
  return (
    <ThirdPartyComponent css={{ width: width ? `${width}px` : '100%' }} {...props} />;
  );
};

For the record, the issue still happens when using an HTML tag (i.e. div) instead of a custom ThirdPartyComponent.

Is this a bug or is it intended behaviour after the upgrade?

Note: I'm building my application with the latest versions of Webpack 5 and Babel 7, and using [email protected]

@quantizor
Copy link
Collaborator

@jbanulso could you try 2.0.1-test and let me know how it goes?

@jbanulso
Copy link
Author

@probablyup 2.0.1 breaks my application even further... Even usage of simple css prop is broken now.

I had a workaround for my original problem that used to work, but not anymore. My ThirdPartyComponent complains that children is undefined.

const MyComponent = ({ width: w, ...props }) => {
  const width = w ? `${w}px` : '100%'
  return (
    <ThirdPartyComponent css={{ width }} {...props} />;
  );
};

So, to sum up, these are the use cases that are broken:

  • css={{ width: width ? `${width}px` : '100%' }} - from v1.13.2
  • css={{ width }}, where const width = w ? `${w}px` : '100%' - from v2.0.1
  • css={{ width: '100px' }} - from v2.0.1

@quantizor
Copy link
Collaborator

@jbanulso Interesting, we have tests for all of those scenarios. What sort of build setup do you have?

@jbanulso
Copy link
Author

@jbanulso Interesting, we have tests for all of those scenarios. What sort of build setup do you have?

Latest versions of Webpack 5 and Babel 7. [email protected]

@jbanulso
Copy link
Author

jbanulso commented Nov 24, 2021

And in case it's worth mentioning it, the particular third-party component I've experienced these problems with is the Accordion from @reach/accordion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants