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

[BUG] `_super` within RSVP callback doesn't reference the correct method #13280

Closed
dandehavilland opened this issue Apr 8, 2016 · 1 comment
Closed

Comments

@dandehavilland
Copy link

@dandehavilland dandehavilland commented Apr 8, 2016

I couldn't find anything about whether this behaviour is intended, but it certainly feels like a bug to me.

These are the basics:

// assuming the object as at least one `Mixin` or parent
myMethod: function() {
  RSVP.resolve().then(() => {
    this._super.apply(this, arguments);
    // this._super === ROOT();
  });
  this._super.apply(this, arguments);
  // this._super === superWrapper()
}

Twiddle here

Workaround:

myMethod: function() {
  let correctSuper = this._super;
  RSVP.resolve().then(() => {
    correctSuper.apply(this, arguments);
    // correctSuper === superWrapper();
  });
  this._super.apply(this, arguments);
  // this._super === superWrapper()
}
@dandehavilland dandehavilland changed the title `_super` within RSVP callback isn't bound to the correct method. [BUG] `_super` within RSVP callback isn't bound to the correct method. Apr 8, 2016
@dandehavilland dandehavilland changed the title [BUG] `_super` within RSVP callback isn't bound to the correct method. [BUG] `_super` within RSVP callback doesn't reference the correct method Apr 8, 2016
@stefanpenner
Copy link
Member

@stefanpenner stefanpenner commented Apr 8, 2016

This is working as expected, _super is a synchronous construct, if you wish to preserve it asynchronously, you must capture and bind it.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.