mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
cache clone rule
Otherwise every time we read this value it will be re-cloned
This commit is contained in:
parent
5260c71c60
commit
e417da262e
@ -84,6 +84,11 @@ const extractUtilityNames = useMemo(
|
||||
selector => selector
|
||||
)
|
||||
|
||||
const cloneRuleWithParent = useMemo(
|
||||
rule => rule.clone({ parent: rule.parent }),
|
||||
rule => rule
|
||||
)
|
||||
|
||||
function buildUtilityMap(css) {
|
||||
let index = 0
|
||||
const utilityMap = {}
|
||||
@ -101,9 +106,7 @@ function buildUtilityMap(css) {
|
||||
utilityName,
|
||||
classPosition: i,
|
||||
get rule() {
|
||||
// TODO: #perf every time we "read" this value we will create a copy.
|
||||
// Is this an issue?
|
||||
return rule.clone({ parent: rule.parent })
|
||||
return cloneRuleWithParent(rule)
|
||||
},
|
||||
})
|
||||
index++
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user