-
Notifications
You must be signed in to change notification settings - Fork 602
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 "Pending Owner Invites" page #5185
Add pagination to the "Pending Owner Invites" page #5185
Conversation
Currently the `crate_id` which is a `string` with the crate's name is attempted to be parsed on serialization, causing trouble at the moment of fetching crates in fixtures db.
hash.crate_id = Number(hash.crate_id); | ||
// TODO: Check this further, `crate_id` are strings in the current fixtures | ||
// when attempting to parse into number we will get `NaN`s here. | ||
// hash.crate_id = Number(hash.crate_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is causing some trouble when retrieving crates by its ID, given that crates IDs are actually strings with the name of such crate.
I'm taking this back to draft as I still have to check for backend pagination support |
d48c43e
to
78d249b
Compare
…r-invites-pagination
Hi @Turbo87! Im working on providing support for the seek pagination format on the pagination component. As I see in this fragment
As we must know the ids of the last entry in the current page in order to fetch the next page (or a specific one), I was thinking about retrieving next sets as part of the meta included in the response. For instance if you fetch page 1 and establishing that we will always have a range of 10 pages per view. I would retrieve a What do you think? Perhaps we already have a definition for this? Thanks in advance! |
36c2d62
to
b83213c
Compare
b83213c
to
80db2b4
Compare
Moved into just next page support due to the behavior of the seek pagination. DemoScreen.Recording.2022-09-14.at.4.30.42.PM.mov |
export function pagination() { | ||
return macro(function () { | ||
const { nextPage } = this; | ||
const nextPageParams = new URLSearchParams(nextPage); | ||
|
||
return { | ||
nextPage: nextPageParams.get('seek'), | ||
}; | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parses the next_page
value from the response meta
field which comes a URL Query Params, and retrieves the value from seek
(if available) otherwise returns undefined
.
@@ -47,6 +49,7 @@ pub fn list(req: &mut dyn RequestExt) -> EndpointResult { | |||
Ok(req.json(&json!({ | |||
"crate_owner_invitations": crate_owner_invitations, | |||
"users": users, | |||
"meta": meta, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds meta
to the response similar to how its done for crates
endpoint, this way we can retrieve the seek hash for the next page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry that I just noticed this now, but #3763 introduced a new endpoint for the invitations (GET /api/private/crate_owner_invitations
) that already supports seek-based pagination. I guess it would be best if we first switched to this new endpoint in the frontend in a dedicated MR and then implemented pagination on top of it. let me know if you want to tackle this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Lets do that!
So we close this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whatever you prefer. feel free to keep it open and then rebase it once the other stuff is done :)
☔ The latest upstream changes (presumably #5370) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing and moving into another pr with the new seek based pagination... |
Provides the missing pagination for the Pending Owner Invites page
on
/me/pending-invites
.Refer: #4083
Demo
demo.mov