diff --git a/app/assets/javascripts/discourse-common/addon/lib/get-owner.js b/app/assets/javascripts/discourse-common/addon/lib/get-owner.js index 27b31f533b805..b1770fe3aea19 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/get-owner.js +++ b/app/assets/javascripts/discourse-common/addon/lib/get-owner.js @@ -42,5 +42,7 @@ export function getRegister(obj) { }, }; + setOwner(register, owner); + return register; } diff --git a/app/assets/javascripts/discourse/app/widgets/widget.js b/app/assets/javascripts/discourse/app/widgets/widget.js index 8d0e566e69a7f..fa549f46d6ca6 100644 --- a/app/assets/javascripts/discourse/app/widgets/widget.js +++ b/app/assets/javascripts/discourse/app/widgets/widget.js @@ -24,6 +24,7 @@ import { get } from "@ember/object"; import { h } from "virtual-dom"; import { isProduction } from "discourse-common/config/environment"; import { consolePrefix } from "discourse/lib/source-identifier"; +import { getOwner, setOwner } from "@ember/application"; const _registry = {}; @@ -146,6 +147,7 @@ export default class Widget { this.dirtyKeys = opts.dirtyKeys; register.deprecateContainer(this); + setOwner(this, getOwner(register)); this.key = this.buildKey ? this.buildKey(attrs) : null; this.site = register.lookup("service:site");