A platform for community discussion. Free, open, simple.
DEV: Reduce the number of IntersectionObservers (#22933)
Jarek Radosz09502cf627df
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.hbs b/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.hbsindex ed91b635bc3..e7117ba65fe 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.hbs@@ -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}}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.js b/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.jsindex c3d572d5560..0d9b3b6c1fe 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.js+++ b/plugins/chat/assets/javascripts/discourse/components/chat/thread-list.js@@ -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;}