-
-
Notifications
You must be signed in to change notification settings - Fork 112
sortMenu adjustments #797
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
sortMenu adjustments #797
Conversation
f28442a
to
d4e12e5
Compare
src/components/PanelMenuWrapper.js
Outdated
const groupLookup = {}; | ||
let groupIndex; | ||
const panels = React.Children.toArray(children); | ||
let childrenArray = React.Children.toArray(children); |
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.
could be a ternary... let's try to avoid using let
as much as we can please in new code :)
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.
in fact, let's go one more step: just always call sortMenu
and if menuPanelOrder
is null just early-return. much easier to read.
|
||
describe('sortMenu', () => { | ||
it('modifies original array to follow the group, then name order provided', () => { | ||
it('returns a new array of sorted children', () => { |
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.
yes! much more functional :)
Modifying things in-place is almost always a bad idea
💃 as-is, but if you want to do my stylistic changes that's fine too :) |
d4e12e5
to
711084c
Compare
Tests were failing due to an intermittent CI failure, merging |
Tested on streambed this time, gives desired result.

@nicolaskruchten @dmt0 please review