avenger icon indicating copy to clipboard operation
avenger copied to clipboard

Allow partial keys when invalidating cached query

Open marcopiii opened this issue 4 years ago • 0 comments

Suppose we have a query

export const myQuery = compose(
  product({ a: param<string>(), b: param<string>(), c: param<string>() }),
  queryShallow( 
    ({ a, b, c }) => ...do stuff... ,
    available
  )
);

And a command which invalidates it

export const myCommand = command(
  (input: { a: string }) =>  ...  ),
  { myQuery }
);

When we use the command we have to declare a combination of parameters a, b, c for which the cached value is no longer valid.

But if we want to invalidate all the cached values associated with the all the keys which contains a (something like a, *, *) there is no way to do it.

marcopiii avatar May 27 '20 09:05 marcopiii