Debaucus
Debaucus
Explore posts from servers
TtRPC
Created by Debaucus on 7/4/2023 in #❓-help
TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?
So I have a TRPC infiniteQuery:
const { data, fetchNextPage, hasNextPage } =
trpc.server.getAll.useInfiniteQuery(
{
limit: 3,
tag: page,
},
{
getNextPageParam: (lastPage) =>
lastPage[lastPage.length - 1]?.nextCursor ?? null,
}
);
const { data, fetchNextPage, hasNextPage } =
trpc.server.getAll.useInfiniteQuery(
{
limit: 3,
tag: page,
},
{
getNextPageParam: (lastPage) =>
lastPage[lastPage.length - 1]?.nextCursor ?? null,
}
);
As an example, for each 3 gathered, I increase the value of page by 1, when page = 2, the page does a query, resets the pages content and triggers a repeating loop of queries. I want to pass a varying value, be it string or number, to the query and be able to continue from the old content. Any help is welcome
16 replies