Debaucus
TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?
After lots of ChatGPT work and a good break, I have a better understanding, but now I have more questions 😅
This behavior is happening because when you change the tag value in the query, it triggers a new query with the updated tag value. This causes the previous data to be replaced with the new data returned from the updated query.
Does TRPC have an option that works like this?
This will return an array of query results, one for each tag. You can then merge the results from all queries into a single array and display them as desired.This will return an array of query results, one for each tag. You can then merge the results from all queries into a single array and display them as desired.
16 replies
TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?
I apologise if I'm coming across blunt or rude, it's not intended, I've been on this for a few days 😅
I'm just very confused why (what I imagine) a common need is giving me strange behaviour
16 replies
TRPC -useInfiniteQuery() refreshes all data when an input is varied, how to use?
The bit that is confusing me is that if I change the input.
So for example:
This works for example, however, I already have the pre-set values. If I send the
serverTags:
value in the query from the file (shown as tag:
) I get constant resets.
Ultimately, here is my question.
How do you correctly infiniteQuery when changing an input value?
Request 3 of tag: x
, then, a new query is triggered for request 3 of tag: y
, results of tag: x
get overwritten or replaced? At least when I use an array with an index selector number value.16 replies