T
TanStack2y ago
sensitive-blue

Strange useInfiniteQuery behavior

Hi everyone! I am experiencing strange behavior with useInfiniteQuery intermittently, with no root cause have been concluded so far (the issue has been there for a few months). Here is the error that are recorded in sentry (see attached picture). And also the code that calls useChatMessages (attached as well). I assume since in the code snippets i provide, the useChatMessages will only be enabled if the activeChat is not falsy right? Then i still don't get why it still evers throw the error that are reported in Sentry. Is it possible that there is some cases which this scenario happens? If so, how do i design the code so that it doesn't ever throw unexpected error as i provide on the Sentry log? (In short, i want to make sure that the function called inside must respect the enabled options) Thank you!
No description
No description
2 Replies
sensitive-blue
sensitive-blueOP2y ago
Additional context, we are building a chat application which similiar to WhatsApp. Client experience this error after for about 1hr working on the apps itself. So it is highly possible that the activeChat here is toggled multiple times (example from default value which is null, then user clicks a chat which fill in the value of activeChat, and user closes the chat back, the same goes for repetitive flow in chat application). Plus, i still can't reproduce this behavior until now, so it'd be great if you can also provide me in which scenario this would happen
unwilling-turquoise
unwilling-turquoise2y ago
Query Keys | TanStack Query Docs
At its core, TanStack Query manages query caching for you based on query keys. Query keys have to be an Array at the top level, and can be as simple as an Array with a single string, or as complex as an array of many strings and nested objects. As long as the query key is serializable, and unique to the query's data, you can use it! Simple Que...

Did you find this page helpful?