Purge by query root fields
new
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.