A platform for community discussion. Free, open, simple.
DEV: Remove buffered rendering from topic-list-item (#8589)
Blake Ericksonfc94b6cb9ee7
diff --git a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 b/app/assets/javascripts/discourse/components/topic-list-item.js.es6index 2909dce548e..7bc2d64603c 100644--- a/app/assets/javascripts/discourse/components/topic-list-item.js.es6+++ b/app/assets/javascripts/discourse/components/topic-list-item.js.es6@@ -1,9 +1,8 @@-import discourseComputed from "discourse-common/utils/decorators";+import discourseComputed, { observes } from "discourse-common/utils/decorators";import { alias } from "@ember/object/computed";import Component from "@ember/component";import { schedule } from "@ember/runloop";import DiscourseURL from "discourse/lib/url";-import { bufferedRender } from "discourse-common/lib/buffered-render";import { findRawTemplate } from "discourse/lib/raw-templates";import { wantsNewWindow } from "discourse/lib/intercept-click";import { on } from "@ember/object/evented";@@ -33,12 +32,25 @@ export function navigateToTopic(topic, href) {return false;}-export const ListItemDefaults = {+export default Component.extend({tagName: "tr",classNameBindings: [":topic-list-item", "unboundClassNames", "topic.visited"],attributeBindings: ["data-topic-id"],"data-topic-id": alias("topic.id"),+ didReceiveAttrs() {+ this._super(...arguments);+ this.renderTopicListItem();+ },++ @observes("topic.pinned")+ renderTopicListItem() {+ const template = findRawTemplate("list/topic-list-item");+ if (template) {+ this.set("topicListItemContents", template(this).htmlSafe());+ }+ },+didInsertElement() {this._super(...arguments);@@ -195,6 +207,14 @@ export const ListItemDefaults = {return this.unhandledRowClick(e, topic);},+ actions: {+ toggleBookmark() {+ this.topic.toggleBookmark().finally(() => this.renderTopicListItem());+ }+ },++ unhandledRowClick() {},+navigateToTopic,highlight(opts = { isLastViewedTopic: false }) {@@ -223,27 +243,4 @@ export const ListItemDefaults = {this.highlight();}})-};--export default Component.extend(- ListItemDefaults,- bufferedRender({- rerenderTriggers: ["bulkSelectEnabled", "topic.pinned"],-- actions: {- toggleBookmark() {- this.topic.toggleBookmark().finally(() => this.rerenderBuffer());- }- },-- buildBuffer(buffer) {- const template = findRawTemplate("list/topic-list-item");- if (template) {- buffer.push(template(this));- }- },-- // Can be overwritten by plugins to handle clicks on other parts of the row- unhandledRowClick() {}- })-);+});diff --git a/app/assets/javascripts/discourse/templates/components/topic-list-item.hbs b/app/assets/javascripts/discourse/templates/components/topic-list-item.hbsnew file mode 100644index 00000000000..556c0177f92--- /dev/null+++ b/app/assets/javascripts/discourse/templates/components/topic-list-item.hbs@@ -0,0 +1 @@+{{topicListItemContents}}