DEV: Reduce the number of IntersectionObservers (#22933)
…by adding the `chat/track-message` modifier only to the last thread rather than all of them (plus: don't use Ember's `lastObject`)
This commit is contained in:
parent
13b13a758c
commit
09502cf627
|
@ -15,13 +15,10 @@
|
|||
{{#each this.sortedThreads as |thread|}}
|
||||
<Chat::ThreadList::Item
|
||||
@thread={{thread}}
|
||||
{{chat/track-message
|
||||
(if
|
||||
(eq thread this.sortedThreads.lastObject)
|
||||
this.loadThreads
|
||||
(fn (noop))
|
||||
)
|
||||
}}
|
||||
{{(if
|
||||
(eq thread this.lastThread)
|
||||
(modifier "chat/track-message" this.loadThreads)
|
||||
)}}
|
||||
/>
|
||||
{{else}}
|
||||
{{#if this.threadsCollection.fetchedOnce}}
|
||||
|
|
|
@ -57,6 +57,10 @@ export default class ChatThreadList extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
get lastThread() {
|
||||
return this.sortedThreads[this.sortedThreads.length - 1];
|
||||
}
|
||||
|
||||
get shouldRender() {
|
||||
return !!this.args.channel;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue