DEV: Use `@cached` decorator in `user-menu/menu` (#21558)

This commit is contained in:
Jarek Radosz 2023-05-15 20:40:08 +02:00 committed by GitHub
parent 3e1915383d
commit e25468b2ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 9 deletions

View File

@ -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) => {