diff --git a/src/views/ContactGiftingView.vue b/src/views/ContactGiftingView.vue index ec2f288f..d522729d 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 1f4c900c..e5c699be 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 cae8c7d6..b98fef7b 100644 --- a/src/views/NewEditAccountView.vue +++ b/src/views/NewEditAccountView.vue @@ -33,7 +33,7 @@