Skip to content

Commit

Permalink
Do not apply reordering for empty orders
Browse files Browse the repository at this point in the history
  • Loading branch information
elchininet committed Jan 3, 2024
1 parent 6109183 commit a3daf7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Short example:
* All items in config.order should have unique `item` property
* The items will be ordered according to their `order` property OR in the order of appearance
* If you use the `order` property, make sure either all items (except hidden ones) have this property, or none of them (otherwise order may be messed up)
* All the items placed in the bottom will be moved to the top by default. If you want to have some items in the bottom you need to add them to the `config.order` and specify their `bottom` property on `true`.
* Any items present in the Sidebar, but not in `config.order`, will be shown **on the bottom** of the top part of the list
* Notifications and user account are not part of the sidebar items; it will not be processed

Expand Down
2 changes: 2 additions & 0 deletions src/custom-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ class CustomSidebar {
let orderIndex = 0;
let crossedBottom = false;

if (!order.length) return;

const orderWithItems: ConfigOrderWithItem[] = order.map((orderItem: ConfigOrder): ConfigOrderWithItem => {
const { item, new_item, exact } = orderItem;
const itemLowerCase = item.toLocaleLowerCase();
Expand Down

0 comments on commit a3daf7d

Please sign in to comment.