-
Notifications
You must be signed in to change notification settings - Fork 336
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
feat(your-work): Jira Integration pagination #8916
Conversation
c23153b
to
ceff10b
Compare
@@ -935,7 +935,7 @@ type JiraIssueEdge { | |||
The item at the end of the edge | |||
""" | |||
node: JiraIssue! | |||
cursor: DateTime |
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 connection wasn't truly implemented previously, since our GQL API only accepted a first
arg.
Using a DateTime
cursor here makes things confusing when paginating through items in descending date order, since we'd be querying for everything before the after
date. This also goes against relay best-practices that specify that cursors should be opaque to clients.
Using a normal String
cursor also allows us to forward the first
+ before
GQL connection args directly to the Atlassian API, eliminating complexity around converting our GQL pagination to the Atlassian API's pagination.
This also increases consistency with how the Jira Server GQL API is implemented
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.
just one little thing, nicely done otherwise!
// Request one extra item to see if there are more results | ||
const maxResults = first + 1 | ||
// Relay requires the cursor to be a string | ||
const afterInt = parseInt(after ?? '-1', 10) |
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.
+1 technically after
is a string so could be anything, and then parseInt
will return NaN
. would be good to check agains that
7be1a4f
to
29193eb
Compare
d6d9731
to
8095f45
Compare
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.
Only did short smoke test
const maxResults = first + 1 | ||
// Relay requires the cursor to be a string | ||
const afterInt = parseInt(after ?? '-1', 10) | ||
const startAt = Number.isNaN(afterInt) ? -1 : afterInt + 1 |
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.
+1 if after === null
then afterInt === -1
and startAt === 0
.
If after === 'invalid'
then afterInt = NaN
and startAt === -1
.
This seems a bit odd.
-1 I see we're using this value for cursor calculation, this will be wrong then.
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.
Yea this is a mistake - updated the truthy side of the ternary from -1
to 0
8095f45
to
e1ad8d9
Compare
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.
Are you going to fix pagination in poker scope as well? Otherwise can you please make sure we have an issue for it?
Created #8962 to track pagination for Jira in Poker |
Description
Fixes #8917
Pagination for Your Work - Jira.
Note that because this modifies the Jira GQL API (both pagination args and behavior) there is a risk of regression in the Jira integration for Sprint Poker, so that should be smoke tested more rigorously than usual.
Needs rebase once #8907 lands
Demo
Multiple pages (2 per page):
https://www.loom.com/share/83e737abb0bc4c30a1b61f9d20bd29f3?sid=469f4e61-0ecb-44a4-9c40-f7e1dc92cdc2
Paginate on scroll to bottom (7 per page):
https://www.loom.com/share/7dcf95f1fe6249faad5d9fac9f6609ec?sid=112a19e7-eecd-4a06-96a5-1468a95fd8a2
Testing scenarios
Final checklist
One Review Required
if the PR introduces only minor changes, does not contain any architectural changes or does not introduce any new patterns and I think one review is sufficient'