UUDigitalHumanitieslab / parseport

Dutch sentence parser for Spindle + Æthel (and maybe others in the future).
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Fix infinite loading animation #15

Closed XanderVertegaal closed 7 months ago

XanderVertegaal commented 7 months ago

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.

  1. 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.

  2. 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.