Using Tanstack DB without fetching the entire collection #469
Replies: 2 comments 8 replies
-
You would need apply filtering in the query function to ensure that the data that is fetched/synced from the server is only what is needed to display/work with for the use case. In some cases where data may only be hundreds of records, you can perhaps always fetch everything. In other cases, consider the logical boundaries the user will be working within for a particular use case. This could be the scope of a page, aggregate root, etc. |
Beta Was this translation helpful? Give feedback.
-
Right now it's as @craigsmitham says, you need your collections to fetch subsets of data — as large as makes sense. The plan is fairly soon to have APIs where this is fairly automatic — see #315 & #343 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I really like the look of TanStack DB, but I'm pretty puzzled as to how you work with a collection where it's not feasible to fetch the entire collection at once. In working with an app like Notion, it isn't performant or feasible to sync all the data the user might access when the user loads the page. I can't figure out how that would work in TanStackDB, given the
queryFn
is designed to fetch the entire collectionHow would I use TanStackDB in a Notion-like app where the data the user has access vastly exceeds what's possible to download into their browser?
Beta Was this translation helpful? Give feedback.
All reactions