DEV: Set owner on widget instances (#22391)
This allows us to use `getOwner(this)` on widgets (without needing to resort to our custom `discourse-common/lib/get-owner` implementation which has a hacky fallback)
This commit is contained in:
parent
0790e9f4f1
commit
1b693d0d60
|
@ -42,5 +42,7 @@ export function getRegister(obj) {
|
|||
},
|
||||
};
|
||||
|
||||
setOwner(register, owner);
|
||||
|
||||
return register;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue