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

@@ -219,8 +219,27 @@ export default class IdentitySwitcherView extends Vue {
}
async switchAccount(did?: string) {
console.log('[DEBUG] IdentitySwitcher - switchAccount called with DID:', did);
console.log('[DEBUG] IdentitySwitcher - Current activeDid before switch:', this.activeDid);
// Save the new active DID to master settings
await this.$saveSettings({ activeDid: did });
this.$router.push({ name: "account" });
console.log('[DEBUG] IdentitySwitcher - Saved new activeDid to master settings');
// Check if we need to load user-specific settings for the new DID
if (did) {
console.log('[DEBUG] IdentitySwitcher - Loading user-specific settings for DID:', did);
try {
const userSettings = await this.$accountSettings(did);
console.log('[DEBUG] IdentitySwitcher - User settings loaded:', userSettings);
console.log('[DEBUG] IdentitySwitcher - User isRegistered:', userSettings.isRegistered);
} catch (error) {
console.log('[DEBUG] IdentitySwitcher - Error loading user settings:', error);
}
}
// Navigate to home page to trigger the watcher
this.$router.push({ name: "home" });
}
async deleteAccount(id: string) {