Some queries are just not firing at all, stuck in loading=true
state.
#4504
-
Describe the bugI've run into a fairly curious bug where given For example when I refresh a page, triggering a full fetch for all the tree's queries, only a subset of the total queries actually get run, leaving the others in a perpetual
Code example const q1 = useQuery({ queryKey: ["q1"], queryFn: () => {/** */}}) // <-- Sometimes this will run
const q2 = useQuery({ queryKey: ["q2"], queryFn: () => {/** */}}) // <-- Sometimes this will run
const q3 = useQuery({ queryKey: ["q3"], queryFn: () => {/** */}}) // <-- Sometimes this will run Been scratching my head over this for a while now without making any progress or leads, so any help would be much appreciated! Your minimal, reproducible exampleI failed to reproduce this bug in a CodeSandbox Steps to reproduceI've tried to reproduce this in CodeSandbox but have failed, so there's clearly some library interaction happening (which isn't helpful for debugging, sorry). Expected behaviorI expected every query to run upon a reload, but only some are. How often does this bug happen?Every time Screenshots or VideosNo response PlatformOS: macOS (Silicon) react-query version4.15.1 TypeScript version4.8.4 Additional contextThe description I've provided is quite vague, unfortunately, and I'm really unsure as to what's going on and how to reproduce it. But I thought I'd create an issue in case anyone else was having the same problem. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
As you've said, there isn't much we can do here without a reproduction. Maybe you can add code to the codesandbox until it behaves like your app, or you remove code from your app until it looks like the sandbox. It's also not clear to me if the queries are running in the browser or on the server (as you've mentioned nextjs). We can discuss this because I think it sounds really odd, but it's not something I'd keep as a filed issue. Moving to discussions. |
Beta Was this translation helpful? Give feedback.
-
UPDATE: Turned out this had nothing to do with React Query (sorry for bothering you with this issue). The issue was with Network requests hanging, due to a very sneaky server bug. Seemed like RQ played a role since the DevTools e.g. weren't showing some queries that should have been running, but it was the other end of the stack that was problematic. For posterity, the issue was with an |
Beta Was this translation helpful? Give feedback.
UPDATE: Turned out this had nothing to do with React Query (sorry for bothering you with this issue).
The issue was with Network requests hanging, due to a very sneaky server bug. Seemed like RQ played a role since the DevTools e.g. weren't showing some queries that should have been running, but it was the other end of the stack that was problematic.
For posterity, the issue was with an
express-session
custom store failing to call thecallback()
function on all branches, causing the non-deterministic behaviour with hanging requests. Pesky callbacks strike again