T
TanStack3y ago
rival-black

useInfiniteQuery - Resets data on change to input value.

Hello! Before getting deep into it, I should mention I am using the TRPC implementation of react-query, matched I believe https://trpc.io/docs/client/react/useInfiniteQuery. I am also a noob, but very willing to learn! I am attempting to load 3 of a specific input, then query for an additional 3 of a similiar (but not the same) of another input. An example, I query my database for a tagList - const tagsList = "free-to-play,testing,survival,444,custom-game-1"; What I have tested: - Sending a tag: tagList[indexValue], this results in reseting data even with keepPreviousData: true - Sending a page: pageNumber so only the value of the page changes, say 1, 2 3. This additionaly causes the same 'reset' of data, clearing as the input number changes. How do I know its the input causing this behavioir? If I query a limit of 3, and do a random number generator for the index server side, I get my results. However, this isn't really the implementation I want to do and since discovering this behavior I want to understand both why and if I am doing something wrong. Any advice would be appreciated!
1 Reply
rival-black
rival-blackOP3y ago
One suggestion from a core TRPC member was there might be some way of instructing infinite query to always show everything that is in the cache, is this the case?

Did you find this page helpful?