Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($q): allow third-party promises #16471

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ng/q.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,11 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
}

function isStateExceptionHandled(state) {
if (!state) return true;
Copy link
Member

@gkalpak gkalpak Mar 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm...I was going through the code looking for other places that might need fixing and I realized I am not sure why this should be necessary (i.e. where this function would be called from when using a 3rd-party promise library) 😕

Could you share a minimal demo (e.g. plnkr, repo, or live app (with non-minified sources 😁)) that showcases the current failures?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this change is indeed not necessary (relevant discussion).

Copy link

@davidwilder davidwilder Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you share a minimal demo (e.g. plnkr, repo, or live app (with non-minified sources 😁)) that showcaes the current failures?

We are also using using Bluebird.js + angular-bluebird-promises. Setting ngModelOptions raises the TypeError: Cannot set property 'pur' of undefined. Please find a demo here http://plnkr.co/edit/9oDzLt?p=preview

Copy link
Member

@gkalpak gkalpak Nov 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for the reproduction, @davidwilder. Based on the stack trace, the error happens in the markQStateExceptionHandled() method and not isStateExceptionHandled(). As mentioned in #16164 (comment), I don't think isStateExceptionHandled() needs to be changed (but it won't hurt either).

return !!state.pur;
}
function markQStateExceptionHandled(state) {
state.pur = true;
if (state) state.pur = true;
}
function markQExceptionHandled(q) {
markQStateExceptionHandled(q.$$state);
Expand Down