Skip to content

feat: Add new hook for fetching repo token list + pagination to repo token table #97095

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

Merged
merged 3 commits into from
Aug 5, 2025

Conversation

ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented Aug 4, 2025

This PR aims to create the hook for the new repo token list endpoint as well as the pagination stuff for us to swap between pages in the repo token table.

We also remove the createdAt stuff from the token regen table since that doesn't exist on the codecov side. So there are a couple styling updates there to reflect that too.

Follows similar conventions to #96228

Depends on #97007

Closes https://linear.app/getsentry/issue/CCMRG-1482/hook-up-list-endpoint
Closes https://linear.app/getsentry/issue/CCMRG-1443/drop-column-for-token-creation-date

Screenshot 2025-08-04 at 10 58 32 AM

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@ajay-sentry ajay-sentry requested a review from a team as a code owner August 4, 2025 17:37
Copy link

linear bot commented Aug 4, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 4, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

linear bot commented Aug 4, 2025

Comment on lines 80 to 83
getNextPageParam: ([lastPage]) => {
return lastPage.pageInfo?.hasNextPage ? lastPage.pageInfo.endCursor : undefined;
},
getPreviousPageParam: ([firstPage]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question is purely for clarity: thoughts on just naming both params the same name since we only have one page at a time and lastPage and firstPage here are identical?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, that's a good point

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the change in 66d5199 to all our endpoints

Comment on lines +54 to +71
const navigation = delta === -1 ? 'prev' : 'next';
const goPrevPage = navigation === 'prev' && response.hasPreviousPage;
const goNextPage = navigation === 'next' && response.hasNextPage;

navigate({
pathname: path,
query: {
...query,
cursor: goPrevPage
? response.startCursor
: goNextPage
? response.endCursor
: undefined,
navigation,
},
});
},
[navigate, response]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, how does the pagination cursor get stuck?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can usually replicate with some combination of hitting the back button multiple times when we're on the first page, adding a filter / sort and navigate to a forward page and generally clicking stuff really quickly

Copy link
Contributor

@calvin-codecov calvin-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@ajay-sentry ajay-sentry merged commit 56da2f8 into master Aug 5, 2025
46 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/1482-list-endpoint branch August 5, 2025 16:28
andrewshie-sentry pushed a commit that referenced this pull request Aug 7, 2025
…token table (#97095)

This PR aims to create the hook for the new repo token list endpoint as
well as the pagination stuff for us to swap between pages in the repo
token table.

We also remove the createdAt stuff from the token regen table since that
doesn't exist on the codecov side. So there are a couple styling updates
there to reflect that too.

Follows similar conventions to
#96228

Depends on #97007

Closes
https://linear.app/getsentry/issue/CCMRG-1482/hook-up-list-endpoint
Closes
https://linear.app/getsentry/issue/CCMRG-1443/drop-column-for-token-creation-date

<img width="1070" height="851" alt="Screenshot 2025-08-04 at 10 58
32 AM"
src="https://github.com/user-attachments/assets/1cdac64e-2d6b-4118-aaff-6f61f1380738"
/>


<!--

  Sentry employees and contractors can delete or ignore the following.

-->

### Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants