Browse Source

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.
pull/204/head
Matthew Raymer 2 weeks ago
parent
commit
7fd2c4e0c7
  1. 45
      src/views/AccountViewView.vue

45
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;

Loading…
Cancel
Save