Repository navigation
Conversation
🦋 Changeset detectedLatest commit: aee450a The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Couldn't you use local collections for data you're loading in some other way? |
In our case, we can translate the TanStack DB query into the right remote API request about 90% of the time. For the remaining cases, we need a custom request whose results we ingest into the same shared collections. We still want TanStack’s local query evaluation and reactivity in those cases, but without also triggering We could move all acquisition into our own wrapper over local collections, but then we’d need to reproduce the query-to-demand planning TanStack already handles, including joins and pagination. Ideally, we’d keep that machinery for supported queries and opt out of automatic acquisition only when supplying a custom fetch. |
|
@KyleAMathews fwiw I'm also looking for something like this for two use-cases:
Prior art here is something like fetch policies in Relay, would be nice to get like a |
|
Robert feel free to open feature request issues for these. @jchook so for the other 10% how do you load data? Some sort of background job thing? I'm confused still how your app works. |
🎯 Changes
Add
autoLoad: falseto live-query configuration to query data already in collections without fetching or syncing. Results remain reactive, with filtering, joins, and pagination handled by the existing query engine.One use case is application-owned fetching. Some remote API requests cannot be derived correctly from the query IR. Applications need to construct those requests themselves and ingest the results into collections, without the live query triggering additional requests.
Implementation Details
Making
loadSubseta no-op is not sufficient:loadSubset. This is also suppressed whenautoLoadis disabled.autoLoad: false, it indicates that the available rows have been evaluated, even if the collection is empty.autoLoaddefaults totrue. Queries with different settings have separate identities, including with explicit query keys. Collection data remains shared, so updates from other queries or application code still appear in the results.✅ Checklist
pnpm test.🚀 Release Impact
Related discussion
Summary by CodeRabbit
New Features
autoLoadoption for live queries and React query hooks. When disabled, queries observe and react to rows already available in their collections without starting source loading.Tests