Skip to content

Commit

Permalink
Fix asyncIter in legacy-client (#486)
Browse files Browse the repository at this point in the history
* Fix asyncIter in legacy-client

Tested changes

* Add changeset
  • Loading branch information
bryantpark04 authored Jul 16, 2024
1 parent 9846af1 commit cfa3db0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/funny-gorillas-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/legacy-client": patch
---

Fix asyncIter to fetch more than one page
3 changes: 2 additions & 1 deletion packages/legacy-client/src/client/net/loadObjectsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export async function* loadObjectsIterator<
): AsyncIterableIterator<T> {
let pageToken: string | undefined = undefined;
do {
const result = await loadObjectsPage(
const result: Result<Page<T>, LoadObjectSetError> = await loadObjectsPage(
client,
objectApiName,
objectSetDefinition,
Expand All @@ -121,6 +121,7 @@ export async function* loadObjectsIterator<
{ pageToken },
);
if (result.type === "ok") {
pageToken = result.value.nextPageToken;
for (
const obj of result.value.data
) {
Expand Down

0 comments on commit cfa3db0

Please sign in to comment.