You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're experiencing a consistent 500-1000ms delay the first time we call useQuery() for a specific query key (and only the first time for each new query key), even before any network request is initiated.
Is setting up the observer and cache for an individual query supposed to be this expensive?
Observed Behaviour
We have an app that changes an "activeConversationId". Every time this conversationId changes, a 500ms block occurs on react query.
The first time and only the first time a new conversationId is passed in, there's a ~500-1000ms blocker.
So if I select a conversationId, and select a different one, and come back, this won't happen. This means it's not the rendering itself.
Not the network call or downstream result of data changing Even if I set enabled to "false" permanently, this still happens.
3a. The 500ms occurs BEFORE the network request starts
NOT tRPC overhead: Even if I don't use TRPC (we suspected trpc runtime compilation) and use direct queryFn, this still happens.
NOT query key complexity: Tested with simple flat keys like ['simple', id] - still slow Bypassed tRPC's queryOptions() - still slow
NOT cache lookup: Direct getQueryData() calls are instant (~1ms)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
We're experiencing a consistent 500-1000ms delay the first time we call
useQuery()for a specific query key (and only the first time for each new query key), even before any network request is initiated.Is setting up the observer and cache for an individual query supposed to be this expensive?
Observed Behaviour
We have an app that changes an "activeConversationId". Every time this conversationId changes, a 500ms block occurs on react query.
3a. The 500ms occurs BEFORE the network request starts
['simple', id]- still slow Bypassed tRPC'squeryOptions()- still slowgetQueryData()calls are instant (~1ms)Environment
Question
Is this 500ms delay expected behavior when creating queries with new keys in a cache of this size? What am I doing wrong here?
Beta Was this translation helpful? Give feedback.
All reactions