diff --git a/README.md b/README.md index cdbf9ed..3a64e28 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/custom-sidebar.ts b/src/custom-sidebar.ts index 780dc1a..37d53d9 100644 --- a/src/custom-sidebar.ts +++ b/src/custom-sidebar.ts @@ -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();