-
Notifications
You must be signed in to change notification settings - Fork 152
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
Undefined cursor if no connection is found (v2.0.0-alpha.3) #327
Comments
Brilliant, I'm looking at a few bugs around edges, cursors, totalCount and pageInfo now, so this should help in reproduction. Thanks! |
I'm 95% sure the issue is in the pagination helper when it calculates the returned pageInfo object. I believe you just need to change it so that the start and end cursors are null when the count is zero. |
@litewarp I'm not too familiar with it, but according to the Relay specification on Connection types:
https://relay.dev/graphql/connections.htm#sel-FAFFHDCAACE0Bnld And then in the PageInfo section it states:
https://relay.dev/graphql/connections.htm#sel-EALFDDAAACJvB_iO My question would be that in the situation with zero edges would you return a |
Great question. So the Thus, when the total number of edges is zero, it will return a pageInfo object like the following:
Also see PR #331 |
That makes sense to me. I couldn't see how to return a non-null string for |
The fix for this will be released in 2.0.0-alpha.4 shortly, please let us know if it works for you! 🙂 |
Describe the bug
After the #282 merge, I'm getting the error: Cannot read property 'cursor' of undefined.
This only happens when no nodes are connected with a relationship, but the error is not raised if relationships and nodes are found.
Type definitions
To Reproduce
Querying for activity1 works. This is expected as at least one relationship exists.
Results
Querying for activity3 results in the above error. This is not expected, should return an empty array.
Results
Expected behavior
Querying for activity 3 should return the following without errors.
The text was updated successfully, but these errors were encountered: