mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 15:56:02 +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:
@ -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";
|
import extractValue from "./extract-value";
|
||||||
|
|
||||||
export default function handleDescriptor(target, key, desc, params = []) {
|
export default function handleDescriptor(target, key, desc, params = []) {
|
||||||
const val = extractValue(desc);
|
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
|
// We're in a native class, so convert the method to a getter first
|
||||||
desc.writable = false;
|
desc.writable = false;
|
||||||
desc.initializer = undefined;
|
desc.initializer = undefined;
|
||||||
|
Reference in New Issue
Block a user