diff --git a/addon/-private/options.js b/addon/-private/options.js index 5f9c6a41..44988161 100644 --- a/addon/-private/options.js +++ b/addon/-private/options.js @@ -1,13 +1,10 @@ -import EmberObject, { get } from '@ember/object'; import { isDescriptor } from '../utils/utils'; +import EmberObject, { get } from '@ember/object'; +import { isComputed } from '@ember/-internals/metal'; const { keys } = Object; const OPTION_KEYS = '__option_keys__'; -const POSSIBLE_DECORATORS = [ - 'AliasDecoratorImpl' -] - const OptionsObject = EmberObject.extend({ toObject() { return this[OPTION_KEYS].reduce((obj, key) => { @@ -22,9 +19,9 @@ export default class Options { const optionKeys = keys(options); const createParams = { [OPTION_KEYS]: optionKeys, model, attribute }; const someOptionsAreCPs = optionKeys.some((key) => { - return isDescriptor(options[key]) || POSSIBLE_DECORATORS.includes(options[key]?.constructor?.name) + return isComputed(options, key) || isDescriptor(options[key]); }); - + // If any of the options is a CP, we need to create a custom class for it if (someOptionsAreCPs) { return OptionsObject.extend(options).create(createParams);