Order of commits graphQL query

Hello,

Building a .js client for our speckle server. When making a GQL request, it seems that commits are always returned sorted by the latest. Can I confirm if its the case that the first index is always the latest commit?

Apologies if this is documented somewhere, if so, Id be grateful for some links! :slight_smile:

This is correct unless you apply the cursor parameter, in which case the first object will match that or the next in the list after that cursor.

The only time you may run into any issues relying on this is if you have a super active singular Project Stream that there would be a race condition. This is where organising data into Model Branches is useful for this purpose, such that the first commit to a Model Branch is most likely to be what you are looking for they represent that โ€œlatestโ€ version of that Model, whatever the rotational selected for its content.

2 Likes

Where does the screenshot come from?

Well spotted. Normally we point you to Speckle GraphQL API for the API documentation, but that screenshot is from https://speckle.xyz/graphql which is the programmatic query endpoint, which happens to include a frontend to the Apollo GraphQL server.

Not all the Apollo features are supported, but it is an alternative means of parsing the API. Unfortunately URL links donโ€™t work directly to topics.

2 Likes

Nice! Great to know! Thanks. :slight_smile:
Never tried the endpoint directly in the browser, just for requests. :smiley: