MCPcopy Index your code
hub / github.com/TanStack/db / loadMoreIfNeeded

Method loadMoreIfNeeded

packages/db/src/query/effect.ts:879–895  ·  view source on GitHub ↗

* After each graph run step, check if any ordered query's topK operator * needs more data. If so, load more rows via requestLimitedSnapshot.

()

Source from the content-addressed store, hash-verified

877 * needs more data. If so, load more rows via requestLimitedSnapshot.
878 */
879 private loadMoreIfNeeded(): void {
880 for (const [, orderByInfo] of Object.entries(
881 this.optimizableOrderByCollections,
882 )) {
883 if (!orderByInfo.dataNeeded || !orderByInfo.index) continue
884
885 if (this.pendingOrderedLoadPromise) {
886 // Wait for in-flight loads to complete before requesting more
887 continue
888 }
889
890 const n = orderByInfo.dataNeeded()
891 if (n > 0) {
892 this.loadNextItems(orderByInfo, n)
893 }
894 }
895 }
896
897 /**
898 * Load n more items from the source collection, starting from the cursor

Callers 1

runGraphMethod · 0.95

Calls 2

loadNextItemsMethod · 0.95
entriesMethod · 0.45

Tested by

no test coverage detected