MCPcopy Create free account
hub / github.com/TanStack/db / loadSubset

Method loadSubset

packages/db/src/collection/sync.ts:483–499  ·  view source on GitHub ↗

* Requests the sync layer to load more data. * @param options Options to control what data is being loaded * @returns If data loading is asynchronous, this method returns a promise that resolves when the data is loaded. * Returns true if no sync function is configured, if syncMode

(options: LoadSubsetOptions)

Source from the content-addressed store, hash-verified

481 * Returns true if no sync function is configured, if syncMode is 'eager', or if there is no work to do.
482 */
483 public loadSubset(options: LoadSubsetOptions): Promise<void> | true {
484 // Bypass loadSubset when syncMode is 'eager'
485 if (this.syncMode === `eager`) {
486 return true
487 }
488
489 if (this.syncLoadSubsetFn) {
490 const result = this.syncLoadSubsetFn(options)
491 // If the result is a promise, track it
492 if (result instanceof Promise) {
493 this.trackLoadPromise(result)
494 return result
495 }
496 }
497
498 return true
499 }
500
501 /**
502 * Notifies the sync layer that a subset is no longer needed.

Calls 1

trackLoadPromiseMethod · 0.95

Tested by 1