Fix registration status reactivity in HomeView

Resolved issue where registration banner persisted despite successful API registration.
Root cause was loadSettings() being called after initializeIdentity(), overwriting
updated isRegistered value with stale database data.

Changes:
- Remove redundant loadSettings() call from mounted() lifecycle
- Add $nextTick() to force template re-render after registration updates
- Create isUserRegistered computed property for template reactivity
- Clean up debugging console.log statements for production readiness
- Simplify template logic to use standard v-if/v-else pattern

Registration banner now properly disappears when users are registered, and
"Record something given by:" section appears correctly. Fix maintains existing
functionality while ensuring proper Vue reactivity.
This commit is contained in:
Matthew Raymer
2025-07-18 05:10:28 +00:00
parent 901186cbc7
commit 216e245d60
6 changed files with 150 additions and 25 deletions

View File

@@ -249,6 +249,7 @@
</section>
<UsageLimitsSection
v-if="activeDid"
:loading-limits="loadingLimits"
:limits-message="limitsMessage"
:active-did="activeDid"
@@ -967,12 +968,12 @@ export default class AccountViewView extends Vue {
this.loadingProfile = false;
}
// Check limits for registered users
if (this.isRegistered && this.activeDid) {
console.log('[DEBUG] Calling checkLimits from mounted for registered user');
// Check limits for any user with an activeDid (this will also check registration status)
if (this.activeDid) {
console.log('[DEBUG] Calling checkLimits from mounted for user with activeDid');
await this.checkLimits();
} else {
console.log('[DEBUG] Not calling checkLimits - isRegistered:', this.isRegistered, 'activeDid:', this.activeDid);
console.log('[DEBUG] Not calling checkLimits - no activeDid available');
}
// Only check service worker on web platform - Capacitor/Electron don't support it
@@ -1013,7 +1014,16 @@ export default class AccountViewView extends Vue {
* Initializes component state with values from the database or defaults.
*/
async initializeState(): Promise<void> {
console.log('[DEBUG] AccountViewView - initializeState called');
// First get the master settings to see the active DID
const masterSettings = await this.$settings();
console.log('[DEBUG] AccountViewView - Master settings activeDid:', masterSettings.activeDid);
// Then get the account-specific settings
const settings: AccountSettings = await this.$accountSettings();
console.log('[DEBUG] AccountViewView - Account settings loaded for DID:', settings.activeDid);
console.log('[DEBUG] AccountViewView - Account settings isRegistered:', settings?.isRegistered);
this.activeDid = settings.activeDid || "";
console.log('[DEBUG] initializeState - activeDid:', this.activeDid);