Skip to content

Commit

Permalink
Use DEFAULT_GROUP_ID and minor optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktvaldez committed Apr 11, 2019
1 parent 8ba3f73 commit f67d1d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions addons/knobs/src/components/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ export default class KnobPanel extends PureComponent {
);
}

// Always sort 'Other' (ungrouped) tab last without changing the remaining tabs
const entries = Object.entries(groups).filter(entry => entry[0] !== 'Other');
entries.push(Object.entries(groups).find(entry => entry[0] === 'Other'));
// Always sort DEFAULT_GROUP_ID (ungrouped) tab last without changing the remaining tabs
const unsortedEntries = Object.entries(groups);
const entries = unsortedEntries
.filter(entry => entry[0] !== DEFAULT_GROUP_ID)
.push(unsortedEntries.find(entry => entry[0] === DEFAULT_GROUP_ID));

return (
<Fragment>
Expand Down

0 comments on commit f67d1d6

Please sign in to comment.