diff --git a/src/views/ContactGiftingView.vue b/src/views/ContactGiftingView.vue index ec2f288f6..d522729d1 100644 --- a/src/views/ContactGiftingView.vue +++ b/src/views/ContactGiftingView.vue @@ -99,12 +99,10 @@ export default class ContactGiftingView extends Vue { allContacts: Array = []; apiServer = ""; accounts: typeof AccountsSchema; - numAccounts = 0; projectId = localStorage.getItem("projectId") || ""; async beforeCreate() { accountsDB.open(); - this.numAccounts = await accountsDB.accounts.count(); } async created() { @@ -113,7 +111,13 @@ export default class ContactGiftingView extends Vue { const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings; this.apiServer = settings?.apiServer || ""; this.activeDid = settings?.activeDid || ""; - this.allContacts = await db.contacts.orderBy("name").toArray(); + + // .orderBy("name") wouldn't retrieve any entries with a blank name + // .toCollection.sortBy("name") didn't sort in an order I understood + const baseContacts = await db.contacts.toArray(); + this.allContacts = baseContacts.sort((a, b) => + (a.name || "").localeCompare(b.name || ""), + ); localStorage.removeItem("projectId"); diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index 1f4c900c4..e5c699beb 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -364,7 +364,13 @@ export default class ContactsView extends Vue { if (this.showGiveNumbers) { this.loadGives(); } - this.contacts = await db.contacts.orderBy("name").toArray(); + + // .orderBy("name") wouldn't retrieve any entries with a blank name + // .toCollection.sortBy("name") didn't sort in an order I understood + const baseContacts = await db.contacts.toArray(); + this.contacts = baseContacts.sort((a, b) => + (a.name || "").localeCompare(b.name || ""), + ); if (this.contactEndorserUrl) { await this.addContactFromScan(this.contactEndorserUrl); @@ -560,7 +566,13 @@ export default class ContactsView extends Vue { -1, ); } - this.contacts = await db.contacts.orderBy("name").toArray(); + + // .orderBy("name") wouldn't retrieve any entries with a blank name + // .toCollection.sortBy("name") didn't sort in an order I understood + const baseContacts = await db.contacts.toArray(); + this.contacts = baseContacts.sort((a, b) => + (a.name || "").localeCompare(b.name || ""), + ); return; } diff --git a/src/views/NewEditAccountView.vue b/src/views/NewEditAccountView.vue index cae8c7d68..b98fef7b2 100644 --- a/src/views/NewEditAccountView.vue +++ b/src/views/NewEditAccountView.vue @@ -33,7 +33,7 @@