mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not duplicate admin sidebar plugin links (#25780)
When hiding/showing the sidebar, as is the case on mobile and using the toggle in the top left on desktop, we delete and recreate the ember component on the page. This causes the `sections` for each sidebar panel to get re-evaluated every time. For the admin sidebar, this means that we were constantly re-adding the plugin links to the sidebar, causing duplication. This can be fixed by just adding @cached to the getter for sections.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { cached } from "@glimmer/tracking";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
import { ADMIN_NAV_MAP } from "discourse/lib/sidebar/admin-nav-map";
|
||||
import BaseCustomSidebarPanel from "discourse/lib/sidebar/base-custom-sidebar-panel";
|
||||
@@ -213,6 +214,7 @@ export default class AdminSidebarPanel extends BaseCustomSidebarPanel {
|
||||
key = ADMIN_PANEL;
|
||||
hidden = true;
|
||||
|
||||
@cached
|
||||
get sections() {
|
||||
const currentUser = getOwnerWithFallback().lookup("service:current-user");
|
||||
const siteSettings = getOwnerWithFallback().lookup("service:site-settings");
|
||||
|
||||
Reference in New Issue
Block a user