In my app, I'm trying to implement a network search on type. I've a fragment with a search text and tabLayout with 3 tabs (fragments) all fragments are using the same viewModel and same call (with different params) to fetch data from the network.
I followed the these examples: https://blog.mindorks.com/implement-search-using-rxjava-operators-c8882b64fe1d
https://proandroiddev.com/implementing-search-on-type-in-android-with-rxjava-9ece00f4e266
On the first example, it says that using switchMap I can avoid the network call results which are not needed more but on the second example they make the call on the subscribe.
Which method will be better? If the first one, I would love to get an example how can I implement it (I'm using PageKeyedDataSource to get the data in pages)
Thanks.