Skip to content

Conversation

gr2m
Copy link
Contributor

@gr2m gr2m commented Oct 18, 2019

See this comment for how we can build GraphQL pagination by utilizing a naming convention for cursor variables:
octokit/graphql.js#61 (comment)

Particularly

Alternatively it could require a certain name for the cursor variable, such as cursor_repository_stargazers. The graphqlPaginate method could look for option variables starting with cursor_ and derive the path to the paginating node from the name, so we could have the same method signature as graphql(query, variables).

closes https://github.com/octokit/maintainers/issues/31

@oscard0m
Copy link
Member

Hi @gr2m @NickLiffen ! Is this still a plan? Or it's too complicated to handle and there won't be an official pagination helper? octokit/graphql.js#61 (comment)

I would be interested in collaborate on it if it's going to move forward and if it's possible.

Thanks

@gr2m
Copy link
Contributor Author

gr2m commented Apr 26, 2020

Right now I think it's too complicated. We'd probably be better of by creating good tutorials on how to paginate with the current octokit.graphql API. Once we have some good tutorials, we can try to find patterns that might be helpful to codify in a plugin.

@oscard0m
Copy link
Member

Right now I think it's too complicated. We'd probably be better of by creating good tutorials on how to paginate with the current octokit.graphql API. Once we have some good tutorials, we can try to find patterns that might be helpful to codify in a plugin.

Yep,I read the thread on the original issue. I just wanted to know if there were news on this. Maybe this repo should be archieved?

Thanks for your answer!

@gr2m
Copy link
Contributor Author

gr2m commented Apr 26, 2020

I didn't give up hope just yet. I intend to write some tutorials myself, unless someone beats me to it ;)

@oscard0m
Copy link
Member

I didn't give up hope just yet. I intend to write some tutorials myself, unless someone beats me to it ;)

I have zero knowledge on GraphQL right now but I’m catching up with it (as doing with TypeScript xD) so if you think I can help to draft these docs... I’m in! :)

1 similar comment
@oscard0m
Copy link
Member

I didn't give up hope just yet. I intend to write some tutorials myself, unless someone beats me to it ;)

I have zero knowledge on GraphQL right now but I’m catching up with it (as doing with TypeScript xD) so if you think I can help to draft these docs... I’m in! :)

@gr2m
Copy link
Contributor Author

gr2m commented Apr 26, 2020

Here is the recording of Rea's talk I mentioned in the thread at octokit/graphql.js#61
https://www.youtube.com/watch?v=i5pIszu9MeM

Basically I'd convert these to a set of tutorials. Giving Rea full credit of course.

@oscard0m
Copy link
Member

Here is the recording of Rea's talk I mentioned in the thread at octokit/graphql.js#61

https://www.youtube.com/watch?v=i5pIszu9MeM

Basically I'd convert these to a set of tutorials. Giving Rea full credit of course.

I watched the talk yesterday. Super cool talk. Ok about the tutorials but... not sure which structure to follow. Is there any other repo on Octokit with tutorials to follow the approach?

I will draft an index proposal so we can start discussing it! :)

@gr2m
Copy link
Contributor Author

gr2m commented Apr 26, 2020

not sure which structure to follow. Is there any other repo on Octokit with tutorials to follow the approach

Not really, I wish there was though. I published a few tutorial-esque posts to https://dev.to/gr2m/. If you write some up we can just list them in the README.md of https://github.com/octokit/graphql.js for now

@oscard0m
Copy link
Member

not sure which structure to follow. Is there any other repo on Octokit with tutorials to follow the approach

Not really, I wish there was though. I published a few tutorial-esque posts to https://dev.to/gr2m/. If you write some up we can just list them in the README.md of https://github.com/octokit/graphql.js for now

Sure! Let me draft some initial posts and we can discuss it together :)

@gr2m gr2m added the feature label May 5, 2020
@jetersen
Copy link

jetersen commented Jun 3, 2020

@gr2m we have this wonderful pagination script over at release-drafter:
https://github.com/release-drafter/release-drafter/blob/master/lib/pagination.js

Should be flexible enough for most cases. Apart from sub pagination but could properly be fixed easily.
See usage here: https://github.com/release-drafter/release-drafter/blob/master/lib/commits.js

@gr2m
Copy link
Contributor Author

gr2m commented Jun 3, 2020

Thanks a lot for sharing Joseph! I've currently very limited availability, but I will get back to you. I'm looking forward to it!

@gr2m
Copy link
Contributor Author

gr2m commented Jun 12, 2020

@jetersen I was wondering if we could avoid the extra paginatePath parameter by enforcing a naming convention of the cursor variables, see my comment here: octokit/graphql.js#61 (comment)

In the case of your query at https://github.com/release-drafter/release-drafter/blob/master/lib/commits.js, instead of using $after, the variable could be called $cursor_repository_ref_target_history. What do you think?

@jetersen
Copy link

@gr2m I am all for generalizing graphql pagination! Having conventions for cursor variables would make absolute sense and would even support sub pagination :)

@gr2m gr2m self-assigned this Jul 13, 2020
@gr2m gr2m removed their assignment Sep 15, 2020
@gr2m gr2m added the project label Feb 17, 2021
@laughedelic
Copy link

Hi @gr2m! can I help here with anything?

I use GraphQL pagination in a few places in my code and have this functionality reimplemeted a couple of times. It would be nice to have it as a reusable plugin.

@gr2m
Copy link
Contributor Author

gr2m commented Apr 18, 2021

Absolutely! It’s all yours :) And you’d be perfect to build it as you have the real life examples as a test

@ericboucher
Copy link

ericboucher commented May 14, 2022

If it helps, this is how we are thinking about implementing it for our github singer tap
MeltanoLabs/tap-github#118

@gr2m gr2m mentioned this pull request Sep 12, 2022
12 tasks
@gr2m gr2m closed this in #5 Sep 12, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

5 participants