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

Comments

Projects
None yet
2 participants
@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 from `_super` within RSVP callback isn't bound to the correct method. to [BUG] `_super` within RSVP callback isn't bound to the correct method. Apr 8, 2016

@dandehavilland dandehavilland changed the title from [BUG] `_super` within RSVP callback isn't bound to the correct method. to [BUG] `_super` within RSVP callback doesn't reference the correct method Apr 8, 2016

@stefanpenner

This comment has been minimized.

Member

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