Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While I was watching your last two videos:
I wondered if it was possible to skip the subscriptions and work out something differently. I would like to hear your opinion on that matter.
Therefore, I added an idea that simply maps all server requests into a unified result object, which will always start with a loading indicator and give me the appropriate error as soon as any error occurs.
Filter Changes
Further, I changed the behavior of the filter because the filtering mostly happens on the server and will resolve the result with filtered entries.
An extension would be to have the API tell us how many pages could be found for the given filter, and we would always start at
page 1
as soon as the filter changed.Refreshing
The idea of refreshing in case of an error was cool to see, but I often tend to have the requirement to refresh data as it could have been updated on the server. And to give the service the possibility of doing both, I changed the refresh behavior.
Pagination
I did not understand why the current page needed to live in the state. Therefore, I changed that too. If you completely want to prevent the usage of
BehaviorSubject
, there is also a way to archive this via subject. But this would be far more complicated for the use case.