From 4cb1d8848f97eefecf86c64f24415e1bb2b493c3 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 3 Sep 2025 07:48:55 +0000 Subject: [PATCH] migrate: PhotoDialog.vue to use () API - Replace settings.activeDid with () pattern - Maintains backward compatibility with existing functionality - Component now uses active_identity table as single source of truth - Part of ActiveDid migration (2/32 components completed) - Updated migration plan to include lint-fix step --- doc/activeDid-migration-plan.md | 22 +++++++++++++++++++++- src/components/PhotoDialog.vue | 6 +++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/activeDid-migration-plan.md b/doc/activeDid-migration-plan.md index 771754b0..242c9002 100644 --- a/doc/activeDid-migration-plan.md +++ b/doc/activeDid-migration-plan.md @@ -445,12 +445,32 @@ async function rollbackActiveDidMigration(): Promise { | **Start application in browser** | Application loads and initializes IndexedDB database | ✅ COMPLETE | | **Inspect IndexedDB via DevTools** | Verify active_identity table exists and contains data | ✅ COMPLETE | | **Update first component** | One component successfully uses new API pattern | ✅ COMPLETE (HomeView.vue) | -| **Systematic component updates** | All 32 remaining components use new API pattern | 🟢 HIGH | +| **Systematic component updates** | All 32 remaining components use new API pattern (with test:web after each) | 🟢 HIGH | | **Test all platforms** | Web, Electron, iOS, Android platforms verified working | 🟡 MEDIUM | | **Performance optimization** | Reduce excessive $getActiveIdentity() calls | 🟡 MEDIUM | **Critical Blocker**: API layer complete. Ready to proceed with component updates. +## Migration Execution Rule + +### **One Component + Test Pattern** +**Rule**: After migrating each component, run `npm run test:web` and `npm run lint-fix` to verify the change doesn't break existing functionality and meets code standards. + +**Workflow**: +1. **Migrate one component** - Update to use `$getActiveIdentity()` pattern +2. **Run lint-fix** - Ensure code meets project standards +3. **Run test:web** - Verify no regressions introduced +4. **Commit if passing** - Only commit after tests and linting pass +5. **Repeat** - Move to next component + +**Benefits**: +- Catch issues immediately after each change +- Maintain code quality throughout migration +- Easy rollback if problems arise +- Systematic progress tracking + +**Exit Criteria**: All 32 components migrated with passing tests + ## Performance Observations ### Excessive API Calls Detected diff --git a/src/components/PhotoDialog.vue b/src/components/PhotoDialog.vue index 54511f67..c3597b5c 100644 --- a/src/components/PhotoDialog.vue +++ b/src/components/PhotoDialog.vue @@ -268,7 +268,11 @@ export default class PhotoDialog extends Vue { // logger.log("PhotoDialog mounted"); try { const settings = await this.$accountSettings(); - this.activeDid = settings.activeDid || ""; + + // Get activeDid from active_identity table (single source of truth) + const activeIdentity = await this.$getActiveIdentity(); + this.activeDid = activeIdentity.activeDid || ""; + this.isRegistered = !!settings.isRegistered; logger.log("isRegistered:", this.isRegistered); } catch (error: unknown) {