mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
FIX: In prod builds classes may not be "instancesof" EmberObject (#18137)
They do have CoreObject in their prototype chain. Fixes the issue mentioned in https://github.com/discourse/discourse-chat/pull/1204
This commit is contained in:
parent
6570fed175
commit
af7620cef8
|
@ -1,10 +1,11 @@
|
|||
import EmberObject, { computed, get } from "@ember/object";
|
||||
import CoreObject from "@ember/object/core";
|
||||
import { computed, get } from "@ember/object";
|
||||
import extractValue from "./extract-value";
|
||||
|
||||
export default function handleDescriptor(target, key, desc, params = []) {
|
||||
const val = extractValue(desc);
|
||||
|
||||
if (typeof val === "function" && target instanceof EmberObject) {
|
||||
if (typeof val === "function" && target instanceof CoreObject) {
|
||||
// We're in a native class, so convert the method to a getter first
|
||||
desc.writable = false;
|
||||
desc.initializer = undefined;
|
||||
|
|
Loading…
Reference in New Issue
Block a user