ssb: Paranoia around trying to avoid showing stale/irrelevant messages. Need to rethink this approach entirely sometime.
All checks were successful
Build Tilde Friends / Build-Docs (push) Successful in 2m27s
Build Tilde Friends / Build-All (push) Successful in 9m55s

This commit is contained in:
2025-12-11 22:05:06 -05:00
parent 79b7252a27
commit 1382eac7e5
2 changed files with 8 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&8uDmJfrjfiVcvxJlkYli5PqLnO8Xje/1qDVtzAXA7A4=.sha256" "previous": "&/flKW9HptO5lHG19rMwc4GT9rGBFiRqVD87VDbWvsgc=.sha256"
} }

View File

@@ -403,11 +403,11 @@ class TfTabNewsFeedElement extends LitElement {
let self = this; let self = this;
this.loading++; this.loading++;
let messages = []; let messages = [];
let original_hash = this.hash; let original_key = JSON.stringify([this.hash, this.channels_latest ?? {}]);
try { try {
if (this._messages_hash !== this.hash) { if (this._messages_key !== original_key) {
this.messages = []; this.messages = [];
this._messages_hash = this.hash; this._messages_key = original_key;
} }
this._messages_following = JSON.stringify(this.following); this._messages_following = JSON.stringify(this.following);
this._private_messages = JSON.stringify([ this._private_messages = JSON.stringify([
@@ -429,7 +429,8 @@ class TfTabNewsFeedElement extends LitElement {
} finally { } finally {
this.loading--; 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.messages = this.merge_messages(this.messages, messages);
} }
this.time_loading = undefined; this.time_loading = undefined;
@@ -485,7 +486,8 @@ class TfTabNewsFeedElement extends LitElement {
render() { render() {
if ( if (
!this.messages || !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._messages_following !== JSON.stringify(this.following) ||
this._private_messages !== this._private_messages !==
JSON.stringify([ JSON.stringify([