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 {
5151 const sections = [ ] ;
5252 const groupLookup = { } ;
5353 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 ) ;
5955
6056 childrenArray . forEach ( child => {
6157 if ( ! child ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ function sortAlphabetically(a, b) {
99}
1010
1111export default function sortMenu ( children , order ) {
12+ // Break out early if no order is provided
13+ if ( ! order ) {
14+ return children ;
15+ }
16+
1217 // PART 1: only sorting panels (i.e. child with a group and name prop)
1318 // and not other elements (like Buttons, or Logo)
1419 let panelsStartIndex = null ;
You can’t perform that action at this time.
0 commit comments