Replies: 3 comments
-
I looked around for other open-source libraries and found timer-wheel on npm which implements an expiry data structure that appears high quality and fulfills our needs. We could implement a
|
Beta Was this translation helpful? Give feedback.
-
I don’t want to discourage you from investigating react-query but I think this huge amount of queries is not something we’ve optimized for. After about 1k observers, But, if the What you can try is to opt out of our own garbage collection by setting
Then, when you want to remove the query, call |
Beta Was this translation helpful? Give feedback.
-
But I also really want to know why you’d need that many queries. Would every block / word in notion be its own query? That doesn’t sound like a good idea... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm investigating adopting tanstack/query in a large production application called Notion. We need to support tens of thousands of queries on screen at once. I'm concerned that the current implementation of query GC uses individual setTimeout per query. This means after a navigation, tanstack/query-core would call
setTimeout
tens of thousands of times, which can cause a lot of event loop delay.Our solution to this issue with our current internal system is to use a very simple timer coalescing with a scheduler, so instead of 30k setTimeout calls, we have either 0 or 1 calls to setInterval. It would be great to update Removable#scheduleGc to do its scheduling via something like
TimeoutGroup
, similar to how the system usesnotifyManager
. Pseudocode below:to avoid huge event loop delay after navigation unmounts a bunch of QueryObservers.
Beta Was this translation helpful? Give feedback.
All reactions