Skip to content
Discussion options

You must be logged in to vote

There is no such thing because queries should be cached by their parameters, and to do that, you'd have to make them part of the queryKey. So the idiomatic way to do this is described here:

https://tanstack.com/query/v4/docs/guides/disabling-queries#lazy-queries

I don't know how to keep the machine "in sync" with state that it doesn't really own. There is an input proposal on xstate that would solve the problem nicely but I don't think it will get merged in the current way:

There is even an example in there on how to use it with useQuery:

const Component = (props) => {
  const [result] = useQuery();

  const [state, send] = useMachine(machine, {
    input: {
      …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@denisborovikov
Comment options

Answer selected by denisborovikov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants