Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only sort if multiple origins are defined in the frontend
  • Loading branch information
ajlende committed May 31, 2024
commit f158aa2c500dec0478a2c9f4feca14b43d78e10a
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ export default function useSpacingSizes() {
...customSizes,
...themeSizes,
...defaultSizes,
].sort( ( a, b ) => compare( a.slug, b.slug ) );
];

// Only sort if more than one origin has presets defined in order to
// preserve order for themes that don't include default presets and
// want a custom order.
if (
( customSizes.length && 1 ) +
( themeSizes.length && 1 ) +
( defaultSizes.length && 1 ) >
1
) {
sizes.sort( ( a, b ) => compare( a.slug, b.slug ) );
}

return sizes.length > RANGE_CONTROL_MAX_SIZE
? [
Expand Down