From 89b3f304668ab5fab763985001c1dff4fb71911f Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 11 Jun 2025 05:40:05 +0000 Subject: [PATCH] fix: debug and clean up GiftedPrompts contact retrieval logic - Add comprehensive debug logging to identify contact list population issues - Fix array indexing bug in contact mapping (someContactDbIndex -> 0) - Clean up all console.log statements for production readiness - Improve contact retrieval debugging for SQLite and Dexie databases - Maintain core functionality while adding diagnostic capabilities Debugging: Contact list population issues in GiftedPrompts component Cleanup: Remove debug console.log statements --- src/components/GiftedPrompts.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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();