Skip to content
Discussion options

You must be logged in to vote

After scouring the docs, to my knowledge, queryClient has no method out-of-the-box that supports what you are trying to acheive. But, you still might be able to achieve calling both ensureQueryData simultaneously with something like this

export const loader = (queryClient) => async () => {

  const promise1 = queryClient.ensureQueryData({ "key1",  getMyDataQuery1 });
  const promise2 = queryClient.ensureQueryData({ "key2",  getMyDataQuery2 });
  const [myData1, myData2] = await Promise.all([promise1, promise2])

  return {myData1, myData2};
};

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@salicius
Comment options

@samhirtarif
Comment options

Answer selected by TkDodo
@TkDodo
Comment options

@salicius
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants