-
Notifications
You must be signed in to change notification settings - Fork 154
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
Discussion: Cursor-based pagination on unions #344
Comments
So! #362 introduces some further changes into how it is decided which union members will be projected, which fits much better into calculating the total count. From the PR:
With this in place, I believe it should now be a simple enough job to introduce the |
Ok, three ways I think you can do this:
I'm not a cypher expert, but couldn't you run a WHERE filter on the returned edges to filter out the edges before returning it to the GraphQL layer? For example:
I'm in favor of this one. It keeps the count consistent, and the worst case scenario is that you get an edge like the below, which is still helpful as it indicates the resolveType and existence of a node, even if no properties are returned.
You can swap the order of the union filter and the createConnection functions so that you generate the connection based on all the returned values but then filter out the empty ones before returning to the client. The forward cursor-based pagination will still work since the cursors will be calculated in order, but it means that the number of items requested by the user might be different than what is returned.
There's also some wonky math with the totalCount you'd have to keep track of, but I suppose it's possible.
Originally posted by @litewarp in #334 (comment)
The text was updated successfully, but these errors were encountered: