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

Function createReadyCollection

packages/db/tests/paced-mutations.test.ts:20–35  ·  view source on GitHub ↗

* Helper to create a collection that's ready for testing. * Handles all the boilerplate setup: preload, begin, commit, markReady.

(opts: {
  id: string
  getKey: (item: T) => string | number
})

Source from the content-addressed store, hash-verified

18 * Handles all the boilerplate setup: preload, begin, commit, markReady.
19 */
20async function createReadyCollection<T extends object>(opts: {
21 id: string
22 getKey: (item: T) => string | number
23}) {
24 const collection = createCollection(
25 mockSyncCollectionOptionsNoInitialState<T>(opts),
26 )
27
28 const preloadPromise = collection.preload()
29 collection.utils.begin()
30 collection.utils.commit()
31 collection.utils.markReady()
32 await preloadPromise
33
34 return collection
35}
36
37describe(`createPacedMutations`, () => {
38 describe(`with debounce strategy`, () => {

Callers

nothing calls this directly

Calls 5

createCollectionFunction · 0.90
markReadyMethod · 0.80
preloadMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…