Skip to content

Commit 9b1bfd0

Browse files
andjsrkaskoufis
andauthored
Fix runtime behavior to match the type definition (#1558)
Co-authored-by: Adam Skoufis <[email protected]>
1 parent 680097c commit 9b1bfd0

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

.changeset/dry-rabbits-grow.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@vanilla-extract/css': patch
3+
---
4+
5+
`style`: Fixed a bug where nested arrays of classnames could cause missing or malformed CSS during [style composition](https://vanilla-extract.style/documentation/style-composition/) in certain situations.
6+
7+
For example, the following style composition would not generate CSS for the `backgroundColor: 'orange'` style, and would also generate malformed CSS:
8+
9+
```ts
10+
const styleWithNestedComposition = style([
11+
[style1, style2],
12+
{ backgroundColor: 'orange' },
13+
[style3],
14+
]);
15+
```

packages/css/src/style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function composedStyle(rules: Array<StyleRule | ClassNames>, debugId?: string) {
2828
const styleRules = [];
2929

3030
for (const rule of rules) {
31-
if (typeof rule === 'string') {
31+
if (typeof rule === 'string' || Array.isArray(rule)) {
3232
classList.push(rule);
3333
} else {
3434
styleRules.push(rule);

0 commit comments

Comments
 (0)