Skip to content

Commit f5e8c74

Browse files
committed
Don't mutate variants in user's config
1 parent 7e11135 commit f5e8c74

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

__tests__/resolveConfig.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,9 @@ test('the original theme is not mutated', () => {
836836
},
837837
},
838838
},
839+
variants: {
840+
borderColor: ['responsive', 'hover'],
841+
}
839842
}
840843

841844
const defaultConfig = {
@@ -850,7 +853,7 @@ test('the original theme is not mutated', () => {
850853
},
851854
},
852855
variants: {
853-
borderColor: ['responsive', 'hover', 'focus'],
856+
backgroundColor: ['responsive', 'hover', 'focus'],
854857
},
855858
}
856859

@@ -864,5 +867,8 @@ test('the original theme is not mutated', () => {
864867
},
865868
},
866869
},
870+
variants: {
871+
borderColor: ['responsive', 'hover'],
872+
}
867873
})
868874
})

src/util/resolveConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function resolveConfig(configs) {
3939
return defaults(
4040
{
4141
theme: resolveFunctionKeys(mergeExtensions(defaults({}, ...map(configs, 'theme')))),
42-
variants: defaults(...map(configs, 'variants')),
42+
variants: defaults({}, ...map(configs, 'variants')),
4343
},
4444
...configs
4545
)

0 commit comments

Comments
 (0)