Cache.invalidate how it works #2161
-
Hi, I am trying to run So I have this let's say, So when I do delete Am I doing something wrong or is it an urql error or can anyone at least point me in the correct direction, how to remove that (without doing some weird array-in-array-in-array filtering) :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This isn't really derivable from your example but I'm going out on a limb here to say you probably know which const updates = {
Mutation: {
unlinkChildFromParent: (result, args, cache) => {
if (result.unlinkChildFromParent) {
// this means we'll invalidate Parent:id.child
cache.invalidate(cache.keyOfEntity({ __typename: 'Parent', id: args.id }), 'child')
// this means we'll just invalidate Child:id from the cache, this means that when we
// get the parent that used to link to this before it will go
// Parent:id.child --> Child:id --> oh it's missing
cache.invalidate(cache.keyOfEntity({ __typename: 'Child', id: args.id }))
}
}
}
} |
Beta Was this translation helpful? Give feedback.
This isn't really derivable from your example but I'm going out on a limb here to say you probably know which
Parent
you want to invalidate so let's look at this example in specific: