File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,7 @@ class PanelsWithSidebar extends Component {
51
51
const sections = [ ] ;
52
52
const groupLookup = { } ;
53
53
let groupIndex ;
54
- let childrenArray = React . Children . toArray ( children ) ;
55
-
56
- if ( menuPanelOrder ) {
57
- childrenArray = sortMenu ( childrenArray , menuPanelOrder ) ;
58
- }
54
+ const childrenArray = sortMenu ( React . Children . toArray ( children ) , menuPanelOrder ) ;
59
55
60
56
childrenArray . forEach ( child => {
61
57
if ( ! child ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ function sortAlphabetically(a, b) {
9
9
}
10
10
11
11
export default function sortMenu ( children , order ) {
12
+ // Break out early if no order is provided
13
+ if ( ! order ) {
14
+ return children ;
15
+ }
16
+
12
17
// PART 1: only sorting panels (i.e. child with a group and name prop)
13
18
// and not other elements (like Buttons, or Logo)
14
19
let panelsStartIndex = null ;
You can’t perform that action at this time.
0 commit comments