DEV: Prepare plugin-outlet for ember upgrade (#24567)

In modern versions of Ember, `this.parentView` is called internally during component init. We don't want our deprecation message to be triggered by that internal call, so we need an additional check.

Extracted from https://github.com/discourse/discourse/pull/21720
This commit is contained in:
David Taylor 2023-11-27 13:43:02 +00:00 committed by GitHub
parent 86f3e86596
commit 824878f315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -145,7 +145,11 @@ class PluginOutletWithTagNameWrapper extends ClassicComponent {
// Overridden parentView to make this wrapper 'transparent'
// Calling this will trigger the deprecation notice in PluginOutletComponent
get parentView() {
return this._parentView.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;
}
}
set parentView(value) {
this._parentView = value;