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

feat!: rename startCursor and endCursor to before and after #148

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

travis
Copy link
Member

@travis travis commented Feb 22, 2023

After chatting with @alanshaw I did a quick survey of naming conventions for bidirectional paging. After reviewing the following:

I proposed renaming startCursor and endCursor to before and after and de-deprecating cursor.

This results in a paging API that should feel ergonomic to developers expecting a single directional paging API (which typically uses cursor) and developers expecting a bidirectional paging API - startCursor and endCursor are definitely used for bidirectional paging, but, eg Relay seems to have moved to before and after away from startCursor and endCursor.

before and after also have the benefit of being more succinct.

After chatting with @alanshaw I did a quick survey of naming conventions
for bidirectional paging. After reviewing the following:

- https://theburningmonk.com/2018/02/guys-were-doing-pagination-wrong/ - before/after
- https://gist.github.com/tspecht/f4b53e34a2ccf1bdef2c8fb9a475ca05 - startCursor/endCursor
- https://medium.com/hackernoon/bi-directional-cursor-pagination-with-react-js-relay-and-graphql-dc4ad6f9cbb0 before/after
- https://www.apollographql.com/docs/react/pagination/cursor-based/#relay-style-cursor-pagination before/after
- relay's official paging spec uses before/after - https://relay.dev/graphql/connections.htm

I proposed renaming `startCursor` and `endCursor` to `before` and` after` and de-deprecating cursor.

This exposes a paging API that should feel ergonomic to developers
expecting a single directional paging API (which typically uses `cursor`
and developers expecting a bidirectional paging API - `startCursor` and `endCursor` are definitely
used for bidirectional paging, but, eg Relay seems to have moved to `before` and `after` away from `startCursor` and `endCursor`.

`before` and `after` also have the benefit of being more succinct.
@seed-deploy seed-deploy bot temporarily deployed to pr148 February 22, 2023 13:56 Inactive
travis added a commit to storacha/w3cli that referenced this pull request Feb 22, 2023
travis added a commit to storacha/w3up that referenced this pull request Feb 22, 2023
@seed-deploy
Copy link

seed-deploy bot commented Feb 22, 2023

View stack outputs
  • pr148-w3infra-CarparkStack

    Name Value
    BucketName carpark-pr148-0
    Region us-east-2
  • pr148-w3infra-SatnavStack

    Name Value
    BucketName satnav-pr148-0
    Region us-east-2
  • pr148-w3infra-UploadApiStack

    Name Value
    ApiEndpoint https://eodehs1gbb.execute-api.us-east-2.amazonaws.com
    CustomDomain https://pr148.up.web3.storage
  • pr148-w3infra-BusStack

  • pr148-w3infra-ReplicatorStack

  • pr148-w3infra-UcanInvocationStack

  • pr148-w3infra-UploadDbStack

travis added a commit to storacha/w3ui that referenced this pull request Feb 22, 2023
@travis travis merged commit a632872 into main Feb 23, 2023
@travis travis deleted the feat/start-cursor-end-cursor-before-after branch February 23, 2023 06:37
travis added a commit to storacha/w3up that referenced this pull request Feb 23, 2023
gobengo pushed a commit to storacha/w3up that referenced this pull request Apr 11, 2023
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.

3 participants