Stellate Product Updates logo
Back to Homepage Subscribe to Updates

Product Updates

See the latest new features, improvements, and product updates

Labels

  • All Posts
  • Fix
  • Announcement
  • Improvement
  • graph api

Jump to Month

  • January 2023
  • September 2022
  • August 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
Announcement
10 months ago

Purge by query root fields

If you want to purge specific results based on fields and arguments passed to your queries, you can use the _purgeQueryField(fields: [QueryFieldInput!]!) mutation.

The QueryFieldInput argument will be an enum based on your schema if you pushed your schema to GraphCDN (or have introspection enabled), or a string if GraphCDN doesn't have access to your schema.

As an example, let's say you have the following query as part of your application:

{
  package(name: "@urql/core") {
    __typname
    name
  }
}

You can then target the package field and purge the above result with the following mutation.

mutation {
  _purgeQueryField(fields: [
    {
      name: "package",
      args: { name: "@urql/core" }
    }
  ])
}

If you pushed your schema to GraphCDN, you could also use more specific mutations based on your schema definition. For example, you would also be able to use the following mutation.

mutation {
  purgeQuery_package(args: [{ name: "@urql/core }])
}

And you can, of course, pass in those arguments via variables as well.

Avatar of authorMarko Locher