MCPcopy
hub / github.com/TanStack/ai / waitForCondition

Function waitForCondition

packages/ai-client/tests/devtools.test.ts:234–242  ·  view source on GitHub ↗
(assertion: () => boolean)

Source from the content-addressed store, hash-verified

232 }
233
234 async function waitForCondition(assertion: () => boolean) {
235 for (let attempt = 0; attempt < 50; attempt++) {
236 if (assertion()) {
237 return
238 }
239 await new Promise((resolve) => setTimeout(resolve, 0))
240 }
241 throw new Error('Timed out waiting for condition')
242 }
243
244 it('does not emit hook lifecycle events before devtools is mounted', () => {
245 const client = createClient({ mountDevtools: false })

Callers 1

devtools.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected