Closed nburnesy closed 4 years ago
Not 100% sure, but I would assume that a host not being available always leads to a rejected promise. Also Promise.finally
was not always available in js, so this might be a problem here.
https://github.com/johannesjo/angular2-promise-buttons/blob/f95a5a4f9a69f9f6ab810a7417e02743467a0cda/src/promise-btn.directive.ts#L180-L187
The finally bit doesn't seem to be relevant, same thing happens with a resolve() in the then and catch blocks.
Shouldn't the button stop spinning on reject? I'm reproducing this issue by clicking the offline checkbox in the chrome network tab.
Also, I can avoid it by wrapping the contents of the promise in setTimeout(0)
It should. That's what the catch is for. And in the examples it also does: https://johannesjo.github.io/angular2-promise-buttons/#demo
Could you maybe provide a more complete example (ideally jsbin, plunkr, etc.?
There are some situations where the button does not resolve, which really confuses me, one example is this:
This works fine until I lose network connection, then resolve() is being hit but the button does not stop spinning. What am I missing here?