Skip to content
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

Update startCursor and endCursor in Connections.md spec #2655

Closed
wants to merge 2 commits into from

Conversation

ngbrown
Copy link
Contributor

@ngbrown ngbrown commented Feb 23, 2019

Actual usage requires that startCursor and endCursor are nullable for empty results.

This is reflected in #2122 and implemented in a17b462.

Allow `PageInfo`'s  `startCursor` and `endCursor` to be null; required for empty results.
@merrywhether
Copy link
Contributor

Note that similar to #2819, you should run yarn update-spec in the website package to also update the published artifacts for the spec site (after rebasing on master).

@paulofaria
Copy link

Any reason this was not merged yet? I got super confused by the spec not allowing null values.

@xenoterracide
Copy link

same, please update spec to provide an answer

@williamboman-pp
Copy link

Yes please! This confused the hell out of me.

@krvajal
Copy link

krvajal commented Oct 15, 2020

If you make the endCursor and startCursor nullable, how can you enforce at the type system level that there are not null when there are results?

@ngbrown
Copy link
Contributor Author

ngbrown commented Oct 19, 2020

@krvajal What else besides null should the cursor value be when there is no result?

A type system doesn't enforce and guarantee correctness in all situations.

@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 25, 2020
@OliverCole
Copy link

Bump

@koenpunt
Copy link

If you make the endCursor and startCursor nullable, how can you enforce at the type system level that there are not null when there are results?

Maybe pageInfo should be nullable instead?

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 8, 2022
@Kingdutch
Copy link

Kingdutch commented Jan 9, 2022

The spec is still lagging implementations here (a.k.a. "bump")

@stale stale bot removed the wontfix label Jan 9, 2022
Copy link

@benjie benjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve this change 👍

Besides the general consensus in this thread, here's some (permalinks for posterity) links to Relay's codebase on main to back it up:

It's clear to me that startCursor/endCursor should be nullable, are treated as nullable by Relay, and are generally implemented in the community as nullable. The specification should reflect this de facto reality.

@facebook-github-bot
Copy link
Contributor

@alunyov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@alphec
Copy link

alphec commented Sep 27, 2022

The spec is not updated yet. I think this PR should be re-opened and most likely merged.

vwkd added a commit to vwkd/kita-verbs-server that referenced this pull request Oct 13, 2022
@lughino
Copy link

lughino commented Oct 27, 2022

This is very frustrating. Could we reopen and merge this PR?
A wrong declaration in the official spec is causing a lot of issues.

@ngbrown
Copy link
Contributor Author

ngbrown commented Oct 27, 2022

@lughino @alphec This pull request changed the file at https://github.com/facebook/relay/blob/main/website/spec/Connections.md#introspection-2

But https://relay.dev/graphql/connections.htm has not been re-rendered from that source file. This has come up before #2457. It appears that I missed the significance of #2655 (comment). However, including the html changes in addition to the source file changes would probably have resulted in undesired merge conflicts over the 3 years it took to merge this pull request.

@lughino
Copy link

lughino commented Oct 28, 2022

Thanks @ngbrown for raising the new PR

facebook-github-bot pushed a commit that referenced this pull request Oct 28, 2022
Summary:
This PR just runs `yarn update-spec` in the website package in order to get the spec site back in sync with the current version of the spec.

Includes updates from #2655

Pull Request resolved: #4109

Reviewed By: lumapat

Differential Revision: D40803673

Pulled By: alunyov

fbshipit-source-id: 3b54b7b83a7e2f15f61a203af8cc54e7059f9bc1
vwkd added a commit to vwkd/kita-verbs-server that referenced this pull request Nov 13, 2022
vwkd added a commit to vwkd/kita-verbs-server that referenced this pull request Nov 13, 2022
vwkd added a commit to vwkd/kita-verbs-server that referenced this pull request Nov 13, 2022
vwkd added a commit to vwkd/kita-verbs-server that referenced this pull request Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.