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 to the query #1300

Open
bega-cinaq opened this issue Mar 4, 2024 · 7 comments
Open

Add pagination to the query #1300

bega-cinaq opened this issue Mar 4, 2024 · 7 comments

Comments

@bega-cinaq
Copy link

Hi, I am using retraced with retraced npm package.
I am trying to get audit logs from -> retracedClient.query().
The problem, there is no pagination fields (pagination functionality).
How I can impletement pagination with retracedClient ?
Thanks.

@deepakprabhakara
Copy link
Contributor

@bega-cinaq In the graphql request you can specify a cursor, the cursor is also returned back for each query. Pagination can be implemented using this - https://boxyhq.com/docs/retraced/apis/graphql#eventedge.

@bega-cinaq
Copy link
Author

bega-cinaq commented Mar 4, 2024

Screenshot_64
@deepakprabhakara I am aware of that, but can I do it with query function what retraced provided.
Should I use retraced api call instead of retraced npm package ?

@deepakprabhakara
Copy link
Contributor

@bega-cinaq You can, the Retraced npm package is just a wrapper around the APIs - https://github.com/retracedhq/retraced-js/blob/main/src/graphql.ts#L76.

@bega-cinaq
Copy link
Author

bega-cinaq commented Mar 5, 2024

@deepakprabhakara Hi, is there any example how it is used in the app ?
I can do nextPage from the frontend, but still don't know how to get prevPage.

Screenshot_65

There is no prevPage function. Is it assume we will do infinity scroll pagination ?
Thanks

@deepakprabhakara
Copy link
Contributor

Since it is cursor based search, for prevPage(s) you will have to keep the previous cursor(s) in memory - https://github.com/retracedhq/logs-viewer/blob/af925483f9e9df465e4d0377fef717063e45f0ca/src/components/containers/EventsBrowser.tsx#L217

@bega-cinaq
Copy link
Author

Example what are you showing does it with api call, not with retraced npm package.
Will do it also with api call, instead of using retraced package.
Thanks

@deepakprabhakara
Copy link
Contributor

@bega-cinaq Aah I see, we'll check to see if it's possible to use the npm package for it. Otherwise it does make sense to add support for it.

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

No branches or pull requests

2 participants