Open
Description
In a project, I have lists of entities called "hypotheses" that need to be refreshed via live queries. These lists are fetched using the following query:
type Query {
hypotheses(
project: ID!
law: Int
filters: ListFiltersInput!
): HypothesisPage!
}
Hypotheses are tied to specific "laws" (identified by integers). The second argument law
can be null
which returns all hypotheses regardless of their laws.
I'm trying to invalidate based on a custom index that looks like this:
{
field: "Query.hypotheses",
args: ["project", "law"]
}
Here is the document I use on the frontend:
export const HypothesesQuery = gql`
${HypothesisPageFragment}
query Hypotheses($project: ID!, $law: Int, $filters: ListFiltersInput!)
@live {
hypotheses(project: $project, law: $law, filters: $filters) {
...HypothesisPage
}
}
`;
Now when creating an hypothesis with a createHypothesis
mutation (resolver is successfully called), the following invalidation doesn't work:
invalidate([
`Query.hypotheses(project:"${project._id.toHexString()}",law:null)`,
`Query.hypotheses(project:"${project._id.toHexString()}",law:${
hypothesis.law
})`
]);
(project._id.toHexString()
has the correct value)
Any idea of what's going on? Thank you.
Metadata
Metadata
Assignees
Labels
No labels