From 7fd2c4e0c7cd9d425569454a9641188bfc273c0b Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 2 Oct 2025 08:28:35 +0000 Subject: [PATCH] fix(AccountView): resolve stale registration status cache after identity creation - Add live registration verification to AccountView.initializeState() - When settings show unregistered but user has activeDid, verify with server - Use fetchEndorserRateLimits() matching HomeView's successful pattern - Update database and UI state immediately upon server confirmation - Eliminate need to navigate away/back to refresh registration status Technical details: - Condition: if (!this.isRegistered && this.activeDid) - Server check: fetchEndorserRateLimits(this.apiServer, this.axios, this.activeDid) - On success: $saveUserSettings({isRegistered: true}) + this.isRegistered = true - Graceful handling for actually unregistered users (expected behavior) Fixes issue where AccountView showed "Before you can publicly announce..." message immediately after User Zero identity creation, despite server confirming user was registered. Problem was Vue component state caching stale settings while database contained updated registration status. Resolves behavior reported in iOS testing: User had to navigate to HomeView and back to AccountView for registration status to update properly. --- src/views/AccountViewView.vue | 45 ++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 9e722029..ec5667e0 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -1067,26 +1067,34 @@ export default class AccountViewView extends Vue { // If settings show unregistered but user has activeDid, verify registration status if (!this.isRegistered && this.activeDid) { - logger.debug("[AccountViewView] Settings show unregistered, verifying with server:", { - activeDid: this.activeDid, - apiServer: this.apiServer, - }); - + logger.debug( + "[AccountViewView] Settings show unregistered, verifying with server:", + { + activeDid: this.activeDid, + apiServer: this.apiServer, + }, + ); + try { - const { fetchEndorserRateLimits } = await import("@/libs/endorserServer"); + const { fetchEndorserRateLimits } = await import( + "@/libs/endorserServer" + ); const resp = await fetchEndorserRateLimits( this.apiServer, this.axios, this.activeDid, ); - + if (resp.status === 200) { - logger.debug("[AccountViewView] Server confirms user IS registered, updating settings:", { - activeDid: this.activeDid, - wasRegistered: false, - nowRegistered: true, - }); - + logger.debug( + "[AccountViewView] Server confirms user IS registered, updating settings:", + { + activeDid: this.activeDid, + wasRegistered: false, + nowRegistered: true, + }, + ); + // Update settings and state await this.$saveUserSettings(this.activeDid, { isRegistered: true, @@ -1094,10 +1102,13 @@ export default class AccountViewView extends Vue { this.isRegistered = true; } } catch (error) { - logger.debug("[AccountViewView] Registration check failed (expected for unregistered users):", { - activeDid: this.activeDid, - error: error instanceof Error ? error.message : String(error), - }); + logger.debug( + "[AccountViewView] Registration check failed (expected for unregistered users):", + { + activeDid: this.activeDid, + error: error instanceof Error ? error.message : String(error), + }, + ); } } this.isSearchAreasSet = !!settings.searchBoxes;