Skip to content

fix(atomic): allow empty atomic styled components - #1555

Open
dhananjay6561 wants to merge 3 commits into
callstack:masterfrom
dhananjay6561:fix/atomic-styled-empty
Open

dhananjay6561 wants to merge 3 commits into
callstack:masterfrom
dhananjay6561:fix/atomic-styled-empty

Conversation

@dhananjay6561

Copy link
Copy Markdown

Motivation

Fixes #1554

An atomic styled component with an empty template (or one that only has a @keyframes block) fails the build with Styles are not extracted yet. Please call extractRules first.

Summary

extractRules sets #classes to '' when no atom has a class name, but the classes getter in AtomicStyledProcessor only checked for a truthy value, so getProps() threw. It now checks for undefined, same as AtomicCssProcessor does since #1164. Added a patch changeset for @linaria/atomic.

Test plan

Added compiles atomic styled with empty css to packages/testkit/src/babel.test.ts. It transforms styled.div `` from @linaria/atomic and checks the output keeps the component class and `atomic: true`. Before the change the transform throws, after it the component compiles like the `@linaria/react` one.

Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Copilot AI balanced review requested due to automatic review settings December 5, 2026 08:20
@changeset-bot

changeset-bot Bot commented Dec 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1869970

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@linaria/atomic Patch
@linaria/core Patch
@linaria/babel-plugin-interop Patch
linaria Patch
@linaria/postcss-linaria Patch
@linaria/react Patch
@linaria/server Patch
@linaria/stylelint-config-standard-linaria Patch
@linaria/stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@dhananjay6561

Copy link
Copy Markdown
Author

Hey @Anber, small one for atomic styled, same fix #1164 did for atomic css. Would be great if you could take a look when you get a chance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@linaria/atomic: empty styled template crashes with "Styles are not extracted yet"

2 participants