When HTTP requests were caught in the catchError block, EMPTY was returned, which completed the observable and prevented any further requests from being made. This is solved with two changes.
The catchError block is moved from the outer observable (the click event) to the inner observable (the actual HTTP request). HTTP requests are cancelled while clicks are still registered.
The catchError block now returns of(null), which is sent to the outer observable so the loading state can be managed properly. The old EMPTY cancels the inner observable (without reaching the outer one). I agree that this is a bit odd, semantically, but actually passing an error would cause the outer observable to stop listening.
Closes #6
When HTTP requests were caught in the
catchError
block,EMPTY
was returned, which completed the observable and prevented any further requests from being made. This is solved with two changes.The
catchError
block is moved from the outer observable (the click event) to the inner observable (the actual HTTP request). HTTP requests are cancelled while clicks are still registered.The
catchError
block now returnsof(null)
, which is sent to the outer observable so the loading state can be managed properly. The oldEMPTY
cancels the inner observable (without reaching the outer one). I agree that this is a bit odd, semantically, but actually passing an error would cause the outer observable to stop listening.