Browse Source

Removed created() and relocated to mounted() could not replicate issue

world-fix
Matthew Raymer 1 year ago
parent
commit
99ea161da0
  1. 19
      src/views/HomeView.vue

19
src/views/HomeView.vue

@ -148,25 +148,17 @@ export default class HomeView extends Vue {
// 'created' hook runs when the Vue instance is first created // 'created' hook runs when the Vue instance is first created
async created() { async created() {
await accountsDB.open();
this.allAccounts = await accountsDB.accounts.toArray();
await db.open();
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray();
this.feedLastViewedId = settings?.lastViewedClaimId;
}
// 'mounted' hook runs after initial render
async mounted() {
try { try {
await accountsDB.open();
this.allAccounts = await accountsDB.accounts.toArray();
await db.open(); await db.open();
const settings = await db.settings.get(MASTER_SETTINGS_KEY); const settings = await db.settings.get(MASTER_SETTINGS_KEY);
this.apiServer = settings?.apiServer || ""; this.apiServer = settings?.apiServer || "";
this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray();
this.feedLastViewedId = settings?.lastViewedClaimId;
this.updateAllFeed(); this.updateAllFeed();
} catch (err) { } catch (err) {
console.log("Error in mounted():", err);
this.alertTitle = "Error"; this.alertTitle = "Error";
this.alertMessage = this.alertMessage =
err.userMessage || err.userMessage ||
@ -217,7 +209,6 @@ export default class HomeView extends Vue {
(acc) => acc.did === this.activeDid, (acc) => acc.did === this.activeDid,
this.allAccounts this.allAccounts
); );
//console.log("about to parse from", this.activeDid, account?.identity);
const identity = JSON.parse(account?.identity || "null"); const identity = JSON.parse(account?.identity || "null");
if (!identity) { if (!identity) {
throw new Error("No identity found."); throw new Error("No identity found.");

Loading…
Cancel
Save