TanStackT
TanStack2mo ago
4 replies
sacred-emerald

Calling `.preload()` on an "on-demand" collection is required to await the results of a live query.

Even though:
Calling .preload() on a collection with syncMode "on-demand" is a no-op. In on-demand mode, data is only loaded when queries request it. Instead, create a live query and call .preload() on that to load the specific data you need.


Awaiting stateWhenReady on a live query that queries an on-demand collection returns no data, unless the parent collection is preloaded before.

See these two screenshots for small illustration.
image.png
image.png
Was this page helpful?