Skip to content

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

DEV: Ensure plugin outlet `parentView` deprecation cannot be avoided (#27973)

David Taylor445951e854cb
diff --git a/app/assets/javascripts/discourse/app/components/plugin-outlet.js b/app/assets/javascripts/discourse/app/components/plugin-outlet.js
index d0ae53f15fa..a35ca161023 100644
--- a/app/assets/javascripts/discourse/app/components/plugin-outlet.js
+++ b/app/assets/javascripts/discourse/app/components/plugin-outlet.js
@@ -50,7 +50,6 @@ const ARGS_DEPRECATION_MSG =
export default class PluginOutletComponent extends GlimmerComponentWithDeprecatedParentView {
@service clientErrorHandler;
-
context = {
...helperContext(),
get parentView() {
@@ -64,6 +63,8 @@ export default class PluginOutletComponent extends GlimmerComponentWithDeprecate
},
};
+ #parentView;
+
constructor() {
const result = super(...arguments);
@@ -136,10 +137,13 @@ export default class PluginOutletComponent extends GlimmerComponentWithDeprecate
deprecated(`${PARENT_VIEW_DEPRECATION_MSG} (outlet: ${this.args.name})`, {
id: "discourse.plugin-outlet-parent-view",
});
- return this._parentView;
+ return this.#parentView;
}
set parentView(value) {
- this._parentView = value;
+ this.#parentView = value;
+ }
+ get _parentView() {
+ return this.parentView;
}
// Older plugin outlets have a `tagName` which we need to preserve for backwards-compatibility
@@ -149,16 +153,21 @@ export default class PluginOutletComponent extends GlimmerComponentWithDeprecate
}
class PluginOutletWithTagNameWrapper extends ClassicComponent {
+ #parentView;
+
// Overridden parentView to make this wrapper 'transparent'
// Calling this will trigger the deprecation notice in PluginOutletComponent
get parentView() {
// init() of CoreView calls `this.parentView`. That would trigger the deprecation notice,
// so skip it until this component is initialized.
if (this._state) {
- return this._parentView.parentView;
+ return this.#parentView.parentView;
}
}
set parentView(value) {
- this._parentView = value;
+ this.#parentView = value;
+ }
+ get _parentView() {
+ return this.parentView;
}
}