Skip to content

Commit

Permalink
always use extend for Internal OptionsObject
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Feb 26, 2024
1 parent 059b9b8 commit f06525a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions addon/-private/options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import EmberObject, { get } from '@ember/object';
import { isDescriptor } from '../utils/utils';

const { keys } = Object;
const OPTION_KEYS = '__option_keys__';
Expand All @@ -18,11 +17,7 @@ export default class Options {
const optionKeys = keys(options);
const createParams = { [OPTION_KEYS]: optionKeys, model, attribute };

// If any of the options is a CP, we need to create a custom class for it
if (optionKeys.some((key) => isDescriptor(options[key]))) {
return OptionsObject.extend(options).create(createParams);
}

return OptionsObject.create(createParams, options);
// we have to extend here in case anyone passes options that have computedProperties.
return OptionsObject.extend(options).create(createParams);
}
}

0 comments on commit f06525a

Please sign in to comment.