Closed dddlr closed 1 week ago
Latest commit: 8b6edba726e3733b36a0c286bd74f0eb31539f50
The changes in this PR will be included in the next version bump.
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
Name | Link |
---|---|
Latest commit | 8b6edba726e3733b36a0c286bd74f0eb31539f50 |
Latest deploy log | https://app.netlify.com/sites/compiled-css-in-js/deploys/67183ef7ea580e000836a4d3 |
What is this change?
Fix the shorthand property sorting being buggy when not using runtime mode (e.g. when using stylesheet extraction).
Why are we making this change?
@kylorhall-atlassian and I noticed that
sortShorthand
wasn't actually sorting the properties as it should.It turns out that a lot of the time in the sorting algorithm, the two properties being compared are
padding
is related topaddingLeft
, butpadding
is not related toborderColor
), andshorthandBuckets
As a result, there are cases where the stylesheet would not be sorted at all, simply because the wrong nodes were being compared and so the
sortNodes
function returns0
every time.How are we making this change?
Fix and simplify the
sortNodes
function:false
most of the time anyway.aShorthandBucket
andbShorthandBucket
, set the default value toInfinity
. This way, if one property is a shorthand property and the other property is not a shorthand property, we guarantee that the shorthand property will come in front. For example,margin
will come beforepaddingRight
(even though they're not related).PR checklist
Don't delete me!
I have...
website/