Skip to content

Commit

Permalink
fix buffer check (#1473)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Polyakov authored Jul 19, 2024
1 parent c54ade4 commit 1ed4735
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/shared/Widget/PriceChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -747,18 +747,18 @@ export default class PriceChartWidget extends Mixins(
private async fetchData(entityId: string): Promise<SnapshotItem[]> {
const { type, count } = this.selectedFilter;
const pageInfoBuffer = this.pageInfos[entityId];
const hasNextPage = pageInfoBuffer?.hasNextPage ?? true;
const endCursor = pageInfoBuffer?.endCursor ?? undefined;
const snapshotsBuffer = this.snapshotBuffer[entityId] ?? [];
const snapshotsUsedCount = this.dataset.length;
const snapshotsUnused = snapshotsBuffer.slice(snapshotsUsedCount);
if (snapshotsUnused.length >= count) {
if (snapshotsUnused.length >= count || !hasNextPage) {
return snapshotsUnused;
}
const pageInfoBuffer = this.pageInfos[entityId];
const hasNextPage = pageInfoBuffer?.hasNextPage ?? true;
const endCursor = pageInfoBuffer?.endCursor ?? undefined;
const { nodes, ...pageInfo } = await this.requestData(entityId, type, count, hasNextPage, endCursor);
const lastTimestamp = last(snapshotsUnused)?.timestamp ?? last(this.dataset)?.timestamp ?? Date.now();
const snapshotsNormalized = normalizeSnapshots(nodes, this.timeDifference, lastTimestamp);
Expand Down

0 comments on commit 1ed4735

Please sign in to comment.