adopted-ember-addons / ember-cp-validations

Ember computed property based validations

Home Page:https://adopted-ember-addons.github.io/ember-cp-validations/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getDependentsFor not working in ember octane throwing maximum call stack size exceeded error

vishwasraj-thyagaraj opened this issue · comments

Environment

  • Ember Version: 3.16.0
  • Ember CLI Version: 3.16.1
  • Ember CP Validations Version: 4.0.0-beta.10

Steps to Reproduce

EmberObject Syntax

ValidatorName.reopenClass({
  getDependentsFor(attribute, options) {
    return [];
  }
});

Class Syntax

@classic
class ValidatorName extends BaseValidator {
  static getDependentsFor(attribute) {
    return []
  };
}
export default ValidatorName;

Screen Shot 2020-07-01 at 7 05 33 PM

Both of syntax throw this error in Octane. Is there an alternative way to achieve this, or am i doing something wrong

The solution for now is to remove getDependentsFor and add volatile: true, which re-computes all other dependent values from model when one value changes in the model

const Validations = buildValidations({
	key1: validator('validator-name', { volatile: true }),
	key2: validator('validator-name', { volatile: true })
});