useInfiniteQuery and server side filtering to data #7093
-
Hi, I am trying to use tanstack query on my async state management however I am stuck at some point. In my app there is a infinite scroll. Without filtering it works correctly however when I try to do some server side filtering in addition to infinite scroll it is now working as I expected. Below is my hook where all logic is happening. In that hook, I am also returning setQuery function to do server side filtering on proper areas. For example, when user check the checkbox of red items, I am filtering red items on the server and want to do infinite scroll logic based on that filtering on the client. Is there any idea?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
everything that you use in your queryFn must be part of your queryKey. we have a lint rule for that. |
Beta Was this translation helpful? Give feedback.
Yeah you are right. I have fixed that issue by passing unique queryKeys for each filtering logic.