Skip to content

preview-defer.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@calvincestari calvincestari released this 05 Apr 02:31
· 56 commits to main since this release

This preview release has been superseded by release 1.14.0.

This is the second preview release of @defer support in Apollo iOS which focuses on providing early access to using the @defer directive in your operations. During preview releases bugs can occur, if you do experience anything unexpected please report it to us.

Note: Apollo supports a very specific version of the @defer directive proposal as documented here. The @defer directive is still in the proposal stage and is not an official addition to the GraphQL specification yet. This means that Apollo iOS may not work with all servers that currently support @defer.

In this release

  • Fixed: If your schema explicitly declared the @defer directive then an error about duplicate directives would be thrown during code generation.
  • Fixed: In some cases the operation metadata for deferred fragments may have been generated with incorrect Swift syntax resulting in a build error.

How to use it

We have a sample schema/server that supports @defer and can be launched using the Docker configuration.

Once you have that service launched you can configure your Apollo iOS client to target the apollo-ios and apollo-ios-codegen dependency packages using the preview-defer.2 tag. Below is an example query using @defer against the schema.

query ExampleQuery {
  allProducts {
    sku
    id
    ... on Product @defer(label: "additional") {
      dimensions {
        size
      }
      variation {
        id
        name
      }
    }
  }
}

Alternatively here is a sample client to demonstrate the code generation and operation execution of the @defer directive.

Caveats in this preview release

  • Caching is intentionally disabled for operations using @defer.