From 3eff1b08a99037968cc20c389bfb33a3afd7140d Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Fri, 9 May 2025 07:27:35 -0400 Subject: [PATCH] ssb: Let about info load in its own time. --- apps/ssb.json | 2 +- apps/ssb/tf-app.js | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 0c2d0a04..f53e226c 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&N/c9mpvJbvtyBsWoW+n9NtPMDRlQktALOGLSIyTeCW8=.sha256" + "previous": "&3J6eTdwcXbt841IXTSh4plSLiHY1+n+iXNRuT76MfQs=.sha256" } diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index db8cca1e..27eba060 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -177,7 +177,6 @@ class TfElement extends LitElement { users = users || {}; for (let row of rows) { users[row.author] = Object.assign( - {follow_depth: following[row.author]?.d}, users[row.author] || {}, JSON.parse(row.about) ); @@ -399,6 +398,7 @@ class TfElement extends LitElement { blocking: v.ob, followed: v.if, blocked: v.ib, + follow_depth: following[id]?.d, }; by_count.push({count: v.of, id: id}); } @@ -409,14 +409,6 @@ class TfElement extends LitElement { ); this.following = Object.keys(following); let about_start_time = new Date(); - users = await this.fetch_about(following, users); - console.log( - 'about took', - (new Date() - about_start_time) / 1000.0, - 'seconds for', - Object.keys(users).length, - 'users' - ); start_time = new Date(); users = await this.fetch_user_info(users); console.log( @@ -425,6 +417,18 @@ class TfElement extends LitElement { 'seconds' ); this.users = users; + + let self = this; + this.fetch_about(following, users).then(function(result) { + self.users = result; + console.log( + 'about took', + (new Date() - about_start_time) / 1000.0, + 'seconds for', + Object.keys(users).length, + 'users' + ); + }); console.log( `load finished ${whoami} => ${this.whoami} in ${(new Date() - start_time) / 1000}` );