Skip to content

A platform for community discussion. Free, open, simple.

FIX: pass custom section willDestroy (#17551)

Krzysztof Kotlarek7230b0d43644
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section.js b/app/assets/javascripts/discourse/app/components/sidebar/section.js
index 41c6c36b925..79eda4f28aa 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/section.js
+++ b/app/assets/javascripts/discourse/app/components/sidebar/section.js
@@ -16,6 +16,12 @@ export default class SidebarSection extends GlimmerComponent {
: false;
}
+ willDestroy() {
+ if (this.args.willDestroy) {
+ this.args.willDestroy();
+ }
+ }
+
@action
toggleSectionDisplay() {
this.displaySection = !this.displaySection;
diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs
index ad291073bd7..12058f9218c 100644
--- a/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs
@@ -18,7 +18,8 @@
@headerLinkText={{customSection.text}}
@headerLinkTitle={{customSection.title}}
@headerActionsIcon={{customSection.actionsIcon}}
- @headerActions={{customSection.actions}}>
+ @headerActions={{customSection.actions}}
+ @willDestroy={{customSection.willDestroy}}>
{{#each customSection.links as |link|}}
<Sidebar::SectionLink