Open paul-sachs opened 3 months ago
Is there any plans to add this in the short term? We've been holding off updating and I'm evaluating if we should make our own little function for the main use case we have: invalidate all instances of a particular RPC.
Hey Joe, we'll update the function in v2, and we're actively working on v2, so it shouldn't be too long 🙂
The main reason to cut a v2 is to support Protobuf-ES v2, so we don't plan on changing the connect-query API too much, but this is a good chance to improve createConnectQueryKey
.
It should be feasible to support creating a key for an entire service, for an individual RPC, and for an RPC with a specific request payload.
BTW, in the interim, you can create a key to invalidate all requests for an RPC with:
const key = createConnectQueryKey(rpc).slice(0, 2);
As of version 1.4.1, query keys are always generated with their default values populated. While this works really well for preventing duplicate queries, it prevents some use cases of
createConnectQueryKey
, primarily when used along withqueryClient.invalidateQueries
. See slack thread.We should expose a standardized way of creating permissive keys that allow more generalized matching where we want to match multiple queries.