I'm currently trying to integrate legend-state into my application. I currently heavily use @tanstack/react-query. So in the process of integrating legend state I first tried using the Fetch plugin, but it currently lacks lots of features we depend on from react-query (namely caching, caching control, cancellable queries, etc). I'm now trying to use the TanStack Query plugin. It seems to work correctly in most cases, but we have queries where the query parameters depend on others conditions/observables.
Mutating the enable$ value will not trigger the query. Event adding the flag to the key (which is not ideal anyways) doesn't seem to work, given that the query params seem to be taken from initialization.
Is there a way to achieve this in legend-state? I'm currently working around it by modifying by queryFn (to for example check the enabled flag), but that's far from ideal.
Hi,
I'm currently trying to integrate legend-state into my application. I currently heavily use @tanstack/react-query. So in the process of integrating legend state I first tried using the Fetch plugin, but it currently lacks lots of features we depend on from react-query (namely caching, caching control, cancellable queries, etc). I'm now trying to use the TanStack Query plugin. It seems to work correctly in most cases, but we have queries where the query parameters depend on others conditions/observables.
Say for example:
Full example: https://codesandbox.io/p/sandbox/4w7k3t
Mutating the
enable$
value will not trigger the query. Event adding the flag to the key (which is not ideal anyways) doesn't seem to work, given that the query params seem to be taken from initialization.Is there a way to achieve this in legend-state? I'm currently working around it by modifying by
queryFn
(to for example check the enabled flag), but that's far from ideal.