diff --git a/src/components/GiftedPrompts.vue b/src/components/GiftedPrompts.vue index 186600d0..99525f84 100644 --- a/src/components/GiftedPrompts.vue +++ b/src/components/GiftedPrompts.vue @@ -227,6 +227,7 @@ export default class GivenPrompts extends Vue { let someContactDbIndex = Math.floor(Math.random() * this.numContacts); let count = 0; + // as long as the index has an entry, loop while ( this.shownContactDbIndices[someContactDbIndex] != null && @@ -245,9 +246,8 @@ export default class GivenPrompts extends Vue { [someContactDbIndex], ); if (result) { - this.currentContact = databaseUtil.mapQueryResultToValues(result)[ - someContactDbIndex - ] as unknown as Contact; + const mappedContacts = databaseUtil.mapQueryResultToValues(result); + this.currentContact = mappedContacts[0] as unknown as Contact; } if (USE_DEXIE_DB) { await db.open();