Hi, I’m using Nuxt with Strapi and trying to get the Apollo Client cache to update after making a change to the Strapi data via a graphql mutation.
This should happen automatically with a single-item mutation — see eg the Edit section in this tutorial: Update Apollo Cache after a mutation and get instant benefits on your UI - DEV Community.
But it doesn’t happen, and I’m suspecting it’s because Strapi requires a more lengthy mutation syntax that makes Apollo think there may be more than one response.
The graphql docs say simple mutations work like this:
mutation updateThing(
$id: ID!,
$label: String!
) {
updateThing(id: $id) {
thing {
id
Label
}
}
}
But I believe for Strapi we need to do this?
mutation updateThing(
$id: ID!,
$label: String!
) {
updateThing(input: {
where: {
id: $id
},
data: {
Label: $label
}
}) {
thing {
id
Label
}
}
}
Am I right? Is this why my Apollo cache does not automatically update?
Can anyone guide me on using Apollo’s update functionality for this?