When working with streams, I am facing a scenario where I have two server calls to make in order to get the required response. However, if the first call returns data, I do not want to execute the second call. I have been struggling to find the proper combination of operators to cancel the second request upon the success of the first one without throwing an error.
I attempted using defaultIfEmpty, but it felt like a hack and I was not satisfied with this approach.
I have prepared a StackBlitz example that you can view here. I am unsure if this is considered good practice or not. Essentially, what I need is a conditional concatMap.
If you are aware of how to achieve this using existing operators without creating new ones, I would appreciate hearing about your solutions and approaches.
Thank you in advance.