Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asking for validations triggers save in Mixin #149

Closed
snewcomer opened this issue Mar 27, 2016 · 5 comments
Closed

Asking for validations triggers save in Mixin #149

snewcomer opened this issue Mar 27, 2016 · 5 comments

Comments

@snewcomer
Copy link

export default Ember.Component.extend(Validations, ComponentCRUD, {
  actions: {
    save() {
      const validations = this.get('validations'); //remove this line and won't hit debugger
   }
var ComponentCRUD = Ember.Mixin.create({
  actions: {
    save(model){
      debugger;
      this.attrs.save(model);
    },
....

Is this the desired behavior?

@offirgolan
Copy link
Collaborator

Any chance you can reproduce this in a demo repo so I can debug this?

@snewcomer
Copy link
Author

I'll put it together and see if I can get to the root of it and throw it up here!

@snewcomer
Copy link
Author

Looks like this is the line.

https://github.com/offirgolan/ember-cp-validations/blob/2154d9276c68811af439b63a588ef21095f820a7/addon/validations/factory.js#L102

Here was the test I wrote. You can see the console logs.
https://github.com/snewcomer/ember-cp-validations/blob/master/tests/acceptance/dummy-index-test.js#L83

So this._super() is calling the _validationsClass computed method on the mixin super class? Is it just a protective measure?

@offirgolan
Copy link
Collaborator

Thanks for setting up a reproduction of the issue. This is definitely not the desired behavior and it's pretty weird tbh. Might need some time to debug this one.

@offirgolan
Copy link
Collaborator

@snewcomer I dumbed this issue down and found it to be an issue with ember itself. I dont really think that this is actually the desired behavior so I went ahead and opened an issue.

emberjs/ember.js#13230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants