Open benbracha opened 9 years ago
Looking at the angular-busy code again, actually - I'm not sure what is the need for angular.compare on the promises at all. Meaning - removing my fix and the compare check together, will have the same result (and fix the issue I originally tried to fix).
All the logic is triggered under $watchCollection on the options parameter. Two scenarios I see here:
To be on the safe side - I'll keep my fix because if fixes the author original intention - trigger reset only on promise changes..
I've forked this to https://github.com/faceleg/angular-busy-plus. Recommend using that as the development focus until / unless the owner becomes active or brings help on board.
Related also to issue https://github.com/cgross/angular-busy/issues/68
In case I change cg-busy unresolved promise with a new unresolved promise - the tracker.reset is not begin called. This is due the use of angular.equals, which doesn't look on "$" fields - so the two above promises looks the same. Because reset is not being called, when the first promise is resolved - the cg-busy overlay is removed, which causes unwanted behaviour (the user still waits for an action, but no overlay).
Therefore, we add to the promise object a random ID, so comparison works correctly. Added also UT that catch this bug, and works after our fix.
Thanks to @barnash for the help in debugging and finding a solution for it.