From 20322789a2f04686bccc6cbf90233038cb7d6217 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 2 Oct 2025 08:27:56 +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 | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 06ac3bb1..9e722029 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -1064,6 +1064,42 @@ export default class AccountViewView extends Vue { this.hideRegisterPromptOnNewContact = !!settings.hideRegisterPromptOnNewContact; this.isRegistered = !!settings?.isRegistered; + + // 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, + }); + + try { + 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, + }); + + // Update settings and state + await this.$saveUserSettings(this.activeDid, { + isRegistered: true, + }); + 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), + }); + } + } this.isSearchAreasSet = !!settings.searchBoxes; this.searchBox = settings.searchBoxes?.[0] || null; this.notifyingNewActivity = !!settings.notifyingNewActivityTime;