matchGqlOperation
Matches the cache keys of every request of a GraphQL operation - with any variables, params, query params and
method. Pass it to
client.cache.invalidate()
after a mutation, so the active queries of the operation refetch, like
refetchQueries
in Apollo.
- A document matches its requests on every url path of the
documentoption. - A request matches the requests of its document on its own url path.
- Documents with the same operation name but other selections are other operations, they do not match.
Import
import { matchGqlOperation } from "@hyper-fetch/graphql"
Source
Package
Usage
await updateUser.send({ payload: { id: "1", name: "Ann" } });
client.cache.invalidate(matchGqlOperation(GetUserDocument));
Parameters
matchGqlOperation(operation: GraphQlEndpointType | RequestInstance)
Parameters
| Name | Type | Description |
|---|---|---|
| operation | |
Returns
RegExp

