TanStackT
TanStack17mo ago
1 reply
dead-brown

Get all query cache ?

Hello,
I'm using trpc, but its related to useQuery/getQueryCache

  const itemsIds = useMemo(() => {
    return data.pages
      .flatMap((page) =>
        page.answers.map((answer) => answer.items.map((i) => i.id)),
      )
      .flat();
  }, [data.pages]);

  const itemsQuery = trpc.items.list.useQuery({
    itemsIds: itemsIds,
  });


As you can see, I'm using infiniteQuery. Therefore when loading more answers, the list of itemsIds evolves. (Every answer can have multiple items)

Do you know if there is a way to get all the cache for current AND past items.list query/queries, please ?
Was this page helpful?