Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resetting skip variable when loading pools from Balancer API #515

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions balancer-js/src/modules/data/pool/balancer-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export class PoolsBalancerAPIRepository
const skip = options?.skip || DEFAULT_SKIP;

const pools = this.pools.slice(skip, first + skip);
this.skip = skip + first;
return pools;
}

Expand All @@ -77,7 +76,10 @@ export class PoolsBalancerAPIRepository
this.pools.length >
(options?.first || DEFAULT_FIRST) + (options?.skip || DEFAULT_SKIP)
) {
return this.fetchFromCache(options);
const cachedPools = this.fetchFromCache(options);
this.skip =
(options?.first || DEFAULT_FIRST) + (options?.skip || DEFAULT_SKIP);
return cachedPools;
}

if (this.nextToken) {
Expand Down
Loading