ssb: Paranoia around trying to avoid showing stale/irrelevant messages. Need to rethink this approach entirely sometime.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&8uDmJfrjfiVcvxJlkYli5PqLnO8Xje/1qDVtzAXA7A4=.sha256"
|
"previous": "&/flKW9HptO5lHG19rMwc4GT9rGBFiRqVD87VDbWvsgc=.sha256"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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([
|
||||||
|
|||||||
Reference in New Issue
Block a user