A platform for community discussion. Free, open, simple.
DEV: Use `@cached` decorator in `user-menu/menu` (#21558)
Jarek Radosze25468b2ca13
diff --git a/app/assets/javascripts/discourse/app/components/user-menu/menu.js b/app/assets/javascripts/discourse/app/components/user-menu/menu.jsindex 31a67ae5c3c..988cd62d616 100644--- a/app/assets/javascripts/discourse/app/components/user-menu/menu.js+++ b/app/assets/javascripts/discourse/app/components/user-menu/menu.js@@ -1,5 +1,5 @@import Component from "@glimmer/component";-import { tracked } from "@glimmer/tracking";+import { cached, tracked } from "@glimmer/tracking";import { action } from "@ember/object";import { NO_REMINDER_ICON } from "discourse/models/bookmark";import UserMenuTab, { CUSTOM_TABS_CLASSES } from "discourse/lib/user-menu/tab";@@ -189,13 +189,8 @@ export default class UserMenu extends Component {@tracked currentPanelComponent = DEFAULT_PANEL_COMPONENT;@tracked currentNotificationTypes;- constructor() {- super(...arguments);- this.topTabs = this._topTabs;- this.bottomTabs = this._bottomTabs;- }-- get _topTabs() {+ @cached+ get topTabs() {const tabs = [];CORE_TOP_TABS.forEach((tabClass) => {@@ -236,7 +231,8 @@ export default class UserMenu extends Component {});}- get _bottomTabs() {+ @cached+ get bottomTabs() {const tabs = [];CORE_BOTTOM_TABS.forEach((tabClass) => {