From 1382eac7e53e936fb6b4f8b62cd502ac20a7f3ac Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 11 Dec 2025 22:05:06 -0500 Subject: [PATCH] ssb: Paranoia around trying to avoid showing stale/irrelevant messages. Need to rethink this approach entirely sometime. --- apps/ssb.json | 2 +- apps/ssb/tf-tab-news-feed.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 8c4553ab..3445ffac 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&8uDmJfrjfiVcvxJlkYli5PqLnO8Xje/1qDVtzAXA7A4=.sha256" + "previous": "&/flKW9HptO5lHG19rMwc4GT9rGBFiRqVD87VDbWvsgc=.sha256" } diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index 38300de1..3f087b71 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -403,11 +403,11 @@ class TfTabNewsFeedElement extends LitElement { let self = this; this.loading++; let messages = []; - let original_hash = this.hash; + let original_key = JSON.stringify([this.hash, this.channels_latest ?? {}]); try { - if (this._messages_hash !== this.hash) { + if (this._messages_key !== original_key) { this.messages = []; - this._messages_hash = this.hash; + this._messages_key = original_key; } this._messages_following = JSON.stringify(this.following); this._private_messages = JSON.stringify([ @@ -429,7 +429,8 @@ class TfTabNewsFeedElement extends LitElement { } finally { this.loading--; } - if (this.hash == original_hash) { + let current_key = JSON.stringify([this.hash, this.channels_latest ?? {}]); + if (current_key === original_key) { this.messages = this.merge_messages(this.messages, messages); } this.time_loading = undefined; @@ -485,7 +486,8 @@ class TfTabNewsFeedElement extends LitElement { render() { if ( !this.messages || - this._messages_hash !== this.hash || + this._messages_key !== + JSON.stringify([this.hash, this.channels_latest ?? {}]) || this._messages_following !== JSON.stringify(this.following) || this._private_messages !== JSON.stringify([