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

Function waitForQueryData

packages/db-collection-e2e/src/utils/helpers.ts:122–136  ·  view source on GitHub ↗
(
  query: Collection<T>,
  options: {
    minSize?: number
    timeout?: number
  } = {},
)

Source from the content-addressed store, hash-verified

120 * snapshot data asynchronously after loadSubset is triggered.
121 */
122export async function waitForQueryData<T extends object>(
123 query: Collection<T>,
124 options: {
125 minSize?: number
126 timeout?: number
127 } = {},
128): Promise<void> {
129 const { minSize = 1, timeout = 2000 } = options
130
131 await waitFor(() => query.size >= minSize, {
132 timeout,
133 interval: 10,
134 message: `Query did not load data (expected >= ${minSize}, got ${query.size})`,
135 })
136}
137
138/**
139 * Create a deduplication counter for testing

Callers 8

createMutationsTestSuiteFunction · 0.90
createJoinsTestSuiteFunction · 0.90
createCollationTestSuiteFunction · 0.90

Calls 1

waitForFunction · 0.70

Tested by

no test coverage detected