-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: usePatternsCategories: simplify category sorting #47843
Conversation
Size Change: -4 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
Flaky tests detected in 5385582. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4122861069
|
98fa2a7
to
5385582
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simplification!
// 1. The categories from `patternCategoriesOrder` in that specific order should be at the top. | ||
// 2. The rest categories should be at the bottom without any re-ordering. | ||
if ( | ||
! [ currentName, nextName ].some( ( categoryName ) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, nice to avoid all these nested loops.
Thank you for the simplification Miguel! |
Follows up on #47760.
What?
Just a minor refactor which I hope makes the sorting in
usePatternsCategories
easier to understand at a glance.Testing Instructions