Fix resetting skip variable when loading pools from Balancer API #515
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.
The skip value is used in two ways: To keep track of where in the cache the frontend has loaded up to when repeatedly loading from the cache, or to track where in the API it's up to if loading from the API.
There was a bug where when reading from the API it would call the read from cache at the end and this would reset the skip variable to the end of the cache instead of the end of the API list. This meant that when returning a filtered list of items from the API it would request say 1000 items, but only get 90 (because of the filter), then it would set set the skip for next time to 1000 (the total requested) when the skip should have actually been 90.
This fixes that bug by only resetting the skip variable to the requested skip amount when fetching from the cache. It keeps the skip set to the total retrieved from the API when results have come from the API.