diff --git a/frontend/src/index.ts b/frontend/src/index.ts index 0ff04270..85cd00c8 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -4,6 +4,7 @@ import { render, type TemplateResult } from "lit"; import { customElement, property, query, state } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { when } from "lit/directives/when.js"; +import { sortBy } from "lodash/fp"; import "broadcastchannel-polyfill"; import "./utils/polyfills"; @@ -361,6 +362,8 @@ export class App extends LiteElement { const orgs = this.appState.userInfo?.orgs; if (!orgs || orgs.length < 2 || !this.appState.userInfo) return; + const sortedOrgs = sortBy("name")(orgs); + const selectedOption = this.appState.orgSlug ? orgs.find(({ slug }) => slug === this.appState.orgSlug) : { slug: "", name: msg("All Organizations") }; @@ -405,7 +408,7 @@ export class App extends LiteElement { `, )} - ${this.appState.userInfo.orgs.map( + ${sortedOrgs.map( (org) => html` ("name")(await this.getOrgs()); } private async getOrgs() {