A platform for community discussion. Free, open, simple.
PR reviews
Alan Guo Xiang Tan1ee9356a548f
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.js b/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.jsindex 6175aa28a19..d3bc1378a7a 100644--- a/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.js+++ b/app/assets/javascripts/discourse/app/components/sidebar/user/categories-section.js@@ -2,9 +2,9 @@ import { inject as service } from "@ember/service";import { action } from "@ember/object";import { cached } from "@glimmer/tracking";+import { debounce } from "discourse-common/utils/decorators";import Category from "discourse/models/category";import SidebarCommonCategoriesSection from "discourse/components/sidebar/common/categories-section";-import discourseDebounce from "discourse-common/lib/debounce";export const REFRESH_COUNTS_APP_EVENT_NAME ="sidebar:refresh-categories-section-counts";@@ -18,10 +18,10 @@ export default class SidebarUserCategoriesSection extends SidebarCommonCategoriesuper(...arguments);this.callbackId = this.topicTrackingState.onStateChange(() => {- this.#refreshCounts();+ this._refreshCounts();});- this.appEvents.on(REFRESH_COUNTS_APP_EVENT_NAME, this, this.#refreshCounts);+ this.appEvents.on(REFRESH_COUNTS_APP_EVENT_NAME, this, this._refreshCounts);}willDestroy() {@@ -32,22 +32,17 @@ export default class SidebarUserCategoriesSection extends SidebarCommonCategoriethis.appEvents.off(REFRESH_COUNTS_APP_EVENT_NAME,this,- this.#refreshCounts+ this._refreshCounts);}- #refreshCounts() {- // TopicTrackingState changes or plugins can trigger this function so we debounce to ensure we're not refreshing- // unnecessarily.- discourseDebounce(- this,- () => {- this.sectionLinks.forEach((sectionLink) => {- sectionLink.refreshCounts();- });- },- 300- );+ // TopicTrackingState changes or plugins can trigger this function so we debounce to ensure we're not refreshing+ // unnecessarily.+ @debounce(300)+ _refreshCounts() {+ this.sectionLinks.forEach((sectionLink) => {+ sectionLink.refreshCounts();+ });}@cached