Skip to content

Commit

Permalink
Fix issue with cursor params being reset before first successful api …
Browse files Browse the repository at this point in the history
…request in node sdk

Summary:
## Checklist

- [X] I've read the [Contributing Guidelines](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md)
- [X] I've completed the [Contributor License Agreement](https://code.facebook.com/cla)

## Pull Request Details

This is related to already closed PR 6a59270

The fix that was merged into facebook-nodejs-business-sdk was overwritten by facebook-business-sdk-codegen. This PR will resole this issue.

The code was reverted in this commit: 3221b62#diff-d5549bbccc9dc8ab94023cc12179c232fcc5d8d2385ad696ad29effcca16bc53

X-link: facebook/facebook-business-sdk-codegen#90

Reviewed By: mengxuanzhangz

Differential Revision: D54955325

Pulled By: stcheng

fbshipit-source-id: c14d757111b57ccdc6bf0e191c589e19e73c22e1
  • Loading branch information
gregleongf authored and facebook-github-bot committed Mar 15, 2024
1 parent 16fdde4 commit 7c38e0c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class Cursor extends Array<Object> {
}
this._api = sourceObject.getApi();
this._targetClass = targetClass;
this.paging = {next: next};
this.paging = {next: next, params: params};

this.clear = () => {
this.length = 0;
Expand Down Expand Up @@ -84,7 +84,7 @@ export default class Cursor extends Array<Object> {
this._loadPage = path => {
const promise = new Promise((resolve, reject) => {
this._api
.call('GET', path, params)
.call('GET', path, this.paging.params)
.then((response: Object) => {
const objects = this._buildObjectsFromResponse(response);
this.set(objects);
Expand All @@ -95,9 +95,7 @@ export default class Cursor extends Array<Object> {
})
.catch(reject);
});
if (params) {
params = undefined;
}

return promise;
};

Expand Down

0 comments on commit 7c38e0c

Please sign in to comment.