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

Add pagination and/or limit options #42

Closed
jgaehring opened this issue Sep 27, 2021 · 0 comments
Closed

Add pagination and/or limit options #42

jgaehring opened this issue Sep 27, 2021 · 0 comments
Milestone

Comments

@jgaehring
Copy link
Member

I'm already running into an issue testing Field Kit on a large database of assets and running into the issue that I'm no longer chaining requests by default, as I was in 1.x:

farmOS.js/index.js

Lines 202 to 214 in 2e3539a

// Recursive request for looping through multiple pages
function requestAll(url, page = 0, list = []) {
return request(`${url}&page=${page}`)
.then((response) => {
const lastPage = +(new URL(response.last)).searchParams.get('page');
if (page === lastPage) {
return { list: list.concat(response.list) };
}
const newList = list.concat(response.list);
return requestAll(url, page + 1, newList);
})
.catch((err) => { throw err; });
}

Especially since assets and areas are now essentially lumped together, there are a lot of assets that I'll need to pull to Field Kit, in order to perform basic actions in Field Kit's Tasks module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant