-
Notifications
You must be signed in to change notification settings - Fork 28
feat: initial version #5
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
Conversation
Co-authored-by: Gregor Martynus <[email protected]>
Hi @gr2m and thank you for the review! 🙂
Agreed. I'll remove the feature and check how much complexity / code can be thrown out.
Sure thing, for me there is no blocker. But having a beta release would be great to let other's test this as well (I already know there are some people who'd like to do so).
To me, it seemed like the 'less magical' and less error prone approach, especially with parallel pagination, as one would rely less on convention and more on putting the cursors yourself in the right positions. But I think it also still came a bit from my misconception that I could be delivering nested pagination with this. From the learnings now, and given that we might not want to support parallel pagination here, I agree that it is probably easier to just set the convention that the cursors name must be '$cursor'. The only question that remains for me here then is if we make the user tell us where to find the paginated resources, so if
From DX, I'd prefer 1, but if we talk bundle size here again, I could delete the entire I'll try it out and measure the difference in bundle size here to have more facts for what this means. |
Bundle Size ComparisonI'll use this issue and update this with the measured bundle-size of the original, cursor-name-based version, the one without parallel pagination support and the one with having the cursorPath be assigned by the user.
|
the idea is that the path is provided by the |
The variable name still would have to be provided somehow though, no? The way this could work would be either by parsing it out of the query or by expecting the user to pass it as a variable with an initial 'null' value - or how would you do it? |
yes, it would be passed as a query variable. The plugin could iterate through all variables, look for the ones that start with For example in octokit.graphql.paginate(`query($owner: String!, $repo: String!, $cursor_repository_stargazers:String) {
repository(name:$owner owner:$repo) {
stargazers(first: 100, after:$cursor_repository_stargazers) {
pageInfo {
endCursor
hasNextPage
}
nodes {
login
company
}
}
}
}`, {
owner: "octokit",
repo: "plugin-paginate-graphql.js"
}) The cursor would be read out at Do you think that'd work? |
Okay got it. We would have to parse it out of the provided query-string then by basically searching in the I'd only object hat the developer experience is a bit worse than with the more 'magical' But I'll try it, and if it has the same impact on the bundle size as going from the function to the pure cursor, that could be a trade off that's worth it. |
yeah I'm with you, I like your approach as well, but it would be great to see the comparison. Regarding typos, we should be able to address that concerns with well crafted error messages |
@gr2m : So I tried the way with having the path in the cursor in this branch here: https://github.com/davelosert/plugin-paginate-graphql.js/tree/pagination-curosr-convention The bundle size is almost similar:
This is probably due to needing another error from the parsing which then makes up for the little less required functionality when parsing the path from the response. So I'd say we leave it as it is here - with the However, I leave the last decision up to you, happy to do it both ways 🙂 WorkflowsI also added the workflow-files now. Two things you would have to do:
Should I change the target to the |
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.
we have to use master
until we rename the default branch. Before we can do that, we also need to configure semantic-release in package.json
, let's do that later
okay
we have a new setup where we use a matrix and a separate
I'm on it, I need GitHub security involvement, I'll have to wait for next week |
Yep that's what I copied over from
Sounds good! 👍🏻 |
Actually nevermind, the |
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Great this is released, thank you for merging! 🥳 Sorry you had some troubles releasing the first version as I seem to have forgotten the |
I did not have time to give this a try but overall congrats for the great work and effort here @davelosert 👏🏽 |
This is the first implementation for my simple solution to a pagination as discussed in octokit/graphql #61.
I am still actively working on this, so it's only a draft for now - but I thought I'd create the PR for visibility purposes.
Open Todos
query myQueryName(variable1: String ...)
) possibleedges
(currently onlynodes
)iterator
functionstartCursor
andhasPreviousPage
for backwards paginationhasNextPage === true
to avoid infinite querying (when both, mixing up cursor order as well as trying nested pagination)Overall status
I'd say about 80% of this are done 🚀 - though it seems like the above list is huge, the heavy lifting is done 🏋🏻 and it currently is in a working state if used as intended and with the limitations (e.g. only endCursor and
nodes
allowed etc.).Now it is mostly about DX and Documentation, so I'll try to finish this up within the week so maybe this can be shipped before friday.
closes #1
closes #3