Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

perf($q): small $q performance optimization #12535

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

Only generate a new promise when then receives some non-undefined parameter

Only generate a new promise when `then` receives some non-undefined parameter
@lgalfaso
Copy link
Contributor Author

This saves a few cycles when calling when without callback, errback nor progressBack as will resolve to a value in one step instead of two

@IgorMinar
Copy link
Contributor

lgtm since the a+ specs are ok with this

@lgalfaso lgalfaso closed this in 6838c97 Aug 11, 2015
lee-tunnicliffe pushed a commit to lee-tunnicliffe/angular.js that referenced this pull request Aug 13, 2015
Only generate a new promise when `then` receives some non-undefined parameter

Closes angular#12535
@akoshelev
Copy link

It seems to be a breaking change for projects that intensively use angular.mocks.$timeout service and unit testing. After this change had applied, many of our tests began crashing with

Error: No deferred tasks to be flushed

before Angular 1.4.4 we had to use $timeout.flush(); in our unit tests when working with $q.when. For now, there are no deferred tasks and $timeout.flush() crashes. It is not a big deal and can be fixed easily but imho it is worth mentioning that in the change log.

@lgalfaso
Copy link
Contributor Author

lgalfaso commented Aug 29, 2015 via email

@akoshelev
Copy link

For sure, please find it here http://plnkr.co/edit/1ajOE3JEiSZvauvjct3D?p=preview
Let me know if you need further information.

@lgalfaso
Copy link
Contributor Author

@akoshelev #12705 should take care of this issue

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

Successfully merging this pull request may close these issues.

None yet

4 participants