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

Function waitForCollectionSize

packages/db-collection-e2e/src/utils/helpers.ts:93–102  ·  view source on GitHub ↗
(
  collection: Collection<T>,
  expectedSize: number,
  timeout = 5000,
)

Source from the content-addressed store, hash-verified

91 * Wait for a collection to reach a specific size
92 */
93export async function waitForCollectionSize<T extends object>(
94 collection: Collection<T>,
95 expectedSize: number,
96 timeout = 5000,
97): Promise<void> {
98 await waitFor(() => collection.size === expectedSize, {
99 timeout,
100 message: `Collection size did not reach ${expectedSize} (current: ${collection.size})`,
101 })
102}
103
104/**
105 * Wait for collection to finish loading (status === 'ready')

Callers

nothing calls this directly

Calls 1

waitForFunction · 0.70

Tested by

no test coverage detected