From 0dc148bfea96f06bb01cd0afc2cf67e2d4c1a373 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Fri, 9 May 2025 07:35:52 -0400 Subject: [PATCH] ssb: Don't forget the about info we know as we reload. --- apps/ssb.json | 2 +- apps/ssb/tf-app.js | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index f53e226c..ae80dfed 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&3J6eTdwcXbt841IXTSh4plSLiHY1+n+iXNRuT76MfQs=.sha256" + "previous": "&NajVQD/6DKISEDlnyAVYh3NPO/vxMN7ksNZy3FwI378=.sha256" } diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index 27eba060..78f34c46 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -363,8 +363,13 @@ class TfElement extends LitElement { [JSON.stringify(Object.keys(users))] ); for (let row of info) { - users[row.author].seq = row.max_seq; - users[row.author].ts = row.max_ts; + users[row.author] = Object.assign( + { + seq: row.max_seq, + ts: row.max_ts, + }, + users[row.author] + ); } return users; } @@ -390,16 +395,20 @@ class TfElement extends LitElement { let start_time = new Date(); let whoami = this.whoami; let following = await tfrpc.rpc.following([whoami], 2); + let old_users = this.users ?? {}; let users = {}; let by_count = []; for (let [id, v] of Object.entries(following)) { - users[id] = { - following: v.of, - blocking: v.ob, - followed: v.if, - blocked: v.ib, - follow_depth: following[id]?.d, - }; + users[id] = Object.assign( + { + following: v.of, + blocking: v.ob, + followed: v.if, + blocked: v.ib, + follow_depth: following[id]?.d, + }, + old_users[id] + ); by_count.push({count: v.of, id: id}); } let reactions = this.load_recent_reactions(); @@ -419,7 +428,7 @@ class TfElement extends LitElement { this.users = users; let self = this; - this.fetch_about(following, users).then(function(result) { + this.fetch_about(following, users).then(function (result) { self.users = result; console.log( 'about took',