angular-promise-tracker icon indicating copy to clipboard operation
angular-promise-tracker copied to clipboard

Active after requests have been satisfied

Open connorbode opened this issue 11 years ago • 4 comments

When $http cache is enabled, the tracker's active() method will sometimes return true after a cache hit.

connorbode avatar Oct 30 '14 18:10 connorbode

Could you provide a plunkr?

ajoslin avatar Nov 15 '14 17:11 ajoslin

Hi, I think I've been having the same issue, and this is what I think is going on.

The issue is in promise-tracker-http-interceptor. Deferred promises are referenced by request config. That's fine, except when a request is configured with option cache = true. Let's say we have a request like that, the first time the request is sent, a promise will be created and its response will be cached. Next time the same request is sent, a new promise will be created but the $http will return the cached response which contains a reference to the first promise already resolved

I'll do a pull request

yeraycaballero avatar Dec 05 '14 22:12 yeraycaballero

any update on this, or is there a work-around? I have the same problem.. using cache: true results in never resolving the tracker

mattcasey avatar May 28 '15 00:05 mattcasey

Hi Matt, Yes there is. I did a pull request a while ago, https://github.com/ajoslin/angular-promise-tracker/pull/64/commits. That should fix it

yeraycaballero avatar May 28 '15 09:05 yeraycaballero