You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing components as selectors, we always attempt to generate an import for the component's base class, which causes issues with components that only have dynamic classes based on props.
The generated CSS assumes there's a base class named Label in the imported component's CSS. However, this assumption fails when the imported component only has dynamic classes based on props:
In this case, there is no base .Label class to target, causing the selector to fail.
Proposed Solutions
Generate Base Class Always
Always generate a base class for components, regardless of whether they have static styles Pros: Maintains backwards compatibility Cons: Additional CSS overhead
Throw Descriptive Error
Detect when a component lacks a base class and throw an error with an explanation of the issue and suggestions for solutions like "add base styles to the component" or "split into separate components" Pros: Clearer developer experience Cons: Breaking change for the migration from styled-components to next-yak
The text was updated successfully, but these errors were encountered:
When importing components as selectors, we always attempt to generate an import for the component's base class, which causes issues with components that only have dynamic classes based on props.
Currently
When using an imported component as a selector:
we generate:
which results in this CSS:
Problem
The generated CSS assumes there's a base class named Label in the imported component's CSS. However, this assumption fails when the imported component only has dynamic classes based on props:
which results in this CSS:
In this case, there is no base .Label class to target, causing the selector to fail.
Proposed Solutions
Generate Base Class Always
Always generate a base class for components, regardless of whether they have static styles
Pros: Maintains backwards compatibility
Cons: Additional CSS overhead
Throw Descriptive Error
Detect when a component lacks a base class and throw an error with an explanation of the issue and suggestions for solutions like "add base styles to the component" or "split into separate components"
Pros: Clearer developer experience
Cons: Breaking change for the migration from
styled-components
tonext-yak
The text was updated successfully, but these errors were encountered: