ssb: prettier.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 27m19s

This commit is contained in:
Cory McWilliams 2025-01-12 12:08:50 -05:00
parent 0d597721bf
commit b8eaa5cf97
2 changed files with 14 additions and 10 deletions

View File

@ -573,7 +573,8 @@ class TfElement extends LitElement {
style="position: static; top: 0; z-index: 10" style="position: static; top: 0; z-index: 10"
> >
<button <button
class=${'w3-bar-item w3-button w3-circle w3-ripple' + (this.connections?.some(x => x.flags.one_shot) ? ' w3-spin' : '')} class=${'w3-bar-item w3-button w3-circle w3-ripple' +
(this.connections?.some((x) => x.flags.one_shot) ? ' w3-spin' : '')}
@click=${this.refresh} @click=${this.refresh}
> >

View File

@ -275,8 +275,8 @@ class TfTabNewsFeedElement extends LitElement {
} }
merge_messages(old_messages, new_messages) { merge_messages(old_messages, new_messages) {
let old_by_id = Object.fromEntries(old_messages.map(x => [x.id, x])); let old_by_id = Object.fromEntries(old_messages.map((x) => [x.id, x]));
return new_messages.map(x => old_by_id[x.id] ? old_by_id[x.id] : x); return new_messages.map((x) => (old_by_id[x.id] ? old_by_id[x.id] : x));
} }
async load_latest() { async load_latest() {
@ -298,14 +298,17 @@ class TfTabNewsFeedElement extends LitElement {
} finally { } finally {
this.loading--; this.loading--;
} }
this.messages = this.merge_messages(this.messages, Object.values( this.messages = this.merge_messages(
Object.fromEntries( this.messages,
[...this.messages, ...messages] Object.values(
.sort((x, y) => x.timestamp - y.timestamp) Object.fromEntries(
.slice(-1024) [...this.messages, ...messages]
.map((x) => [x.id, x]) .sort((x, y) => x.timestamp - y.timestamp)
.slice(-1024)
.map((x) => [x.id, x])
)
) )
)); );
console.log('done loading latest messages.'); console.log('done loading latest messages.');
} }