Scalability when many `useQuery` are used
See original GitHub issueIntended outcome:
Using the same useQuery
throughout many components should have relatively low performance impact.
Actual outcome:
Long task is created when rendering components with many useQuery
s.
How to reproduce the issue: Reproduction Repo
Versions
System:
OS: macOS 12.6
Binaries:
Node: 14.18.3 - ~/.nvm/versions/node/v14.18.3/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.3/bin/yarn
npm: 8.10.0 - ~/.nvm/versions/node/v14.18.3/bin/npm
Browsers:
Chrome: 107.0.5304.121
Firefox: 99.0.1
Safari: 16.0
npmPackages:
@apollo/client: ^3.7.1 => 3.7.1
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to handle multiple queries with React-Query
However, I'm struggling to find a good way to query multiple collections for use in a single component. One Query (no problem): const...
Read more >Multiple queries in a single component with useQuery hook
This seems to be an obvious question, but I'm having a hella time finding an answer. Is it possible to run more than...
Read more >How and Why You Should Use React Query - Bits and Pieces
The useQuery hook is a function used to register your data fetching code into React Query library. It takes an arbitrary key and...
Read more >Effective React Query Keys | TkDodo's blog
The most important part is that keys need to be unique for your queries. If React Query finds an entry for a key...
Read more >Is it possible to call multiple queries with useQuery? #120
Hi, In advance thank you great library. In our product, there is the a page which needs data from 2 or 3 GraphQL...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(sorry to interject)
My guess is it’s probably interacting with the cache often. #10270 mentions the cache as a bottleneck with
useQuery
and I suspect this is in the same ballpark.@jpvajda it’s not network latency it’s 300ms of CPU time (mosly from Apollo’s cache), since in the template repo all data is local to the Apollo cache.
I use chrome devtools “Performance” tab
Hit “record” button and then click the “Click Me” button in my reproduction app, then hit stop recording.