Closed bouncehead13 closed 4 years ago
Hey there! Thank you very much for digging into this. Makes a lot of sense. Haven't thought about this case to be honest. Would you be willing to provide a fix for this? :)
@johannesjo Created a pull request. Let me know your thoughts.
Love it! Especially the unit tests. Thank you very much!
Use case
When the promise button is clicked and calls an API, this is occurring as a subscription. On completion of the subscription, the view changes to display the information.
Switching back to the original view (think of this as a form with a submit button), the original subscription, closed subscription, gets reassigned and the button begins to spin and stops shortly.
Proposed solution
In the code now
If the subscription is already closed, don't create the Promise wrapper. This will solve the problem when switching between views and assigning a subscription already closed. In the meantime, we are clearing the property after success.