Skip to content

Commit

Permalink
fix(computed): on Ember 4.12 / embroider v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixelik committed Sep 14, 2023
1 parent 24b9998 commit 40805d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addon/-private/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ export default class Options {
constructor({ model, attribute, options = {} }) {
const optionKeys = keys(options);
const createParams = { [OPTION_KEYS]: optionKeys, model, attribute };

const someOptionsAreCPs = optionKeys.some((key) => {
return isDescriptor(options[key]) || options[key]?.constructor?.name === 'AliasDecoratorImpl'
});

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

Expand Down

0 comments on commit 40805d3

Please sign in to comment.