Summary
Let's say I have relay paginated savedArticles field that takes folder id into account. If I want to invalidate or resolve it, I need something like:
cache.resolve('Query', 'savedArticles', { "first": 20, "folderId": "187", "term": "" })
I'm removing an article from folder 187. I'm not too interested in the page it is at, all I want is to invalidate all the queries that matches folderId 187. Would make the code more readable and easier to write, if I could simply: cache.invalidate('Query', 'savedArticles', { "folderId": "187" }) without knowing anything about extra arguments. In my use case, the folderId is known by the mutation I'm using while the other variables are not interesting in that regard.Thus, I don't have easy access to them. I want to invalidate everything that matches the folder without caring about the rest of the arguments.
Proposed Solution
I'm proposing partial args matching for the cache resolve & invalidate, similar to pattern matching. This would greatly help with dealing with cache invalidation in resolvers.
Requirements
Summary
Let's say I have relay paginated
savedArticlesfield that takes folder id into account. If I want to invalidate or resolve it, I need something like:cache.resolve('Query', 'savedArticles', { "first": 20, "folderId": "187", "term": "" })I'm removing an article from folder
187. I'm not too interested in the page it is at, all I want is to invalidate all the queries that matchesfolderId187. Would make the code more readable and easier to write, if I could simply:cache.invalidate('Query', 'savedArticles', { "folderId": "187" })without knowing anything about extra arguments. In my use case, thefolderIdis known by the mutation I'm using while the other variables are not interesting in that regard.Thus, I don't have easy access to them. I want to invalidate everything that matches the folder without caring about the rest of the arguments.Proposed Solution
I'm proposing partial args matching for the cache resolve & invalidate, similar to pattern matching. This would greatly help with dealing with cache invalidation in resolvers.
Requirements