MCPcopy Index your code
hub / github.com/TanStack/query / fetchTodoById

Function fetchTodoById

examples/react/playground/src/index.tsx:403–418  ·  view source on GitHub ↗
({ id }: { id: number })

Source from the content-addressed store, hash-verified

401}
402
403function fetchTodoById({ id }: { id: number }): Promise<Todo> {
404 console.info('fetchTodoById', { id })
405 return new Promise((resolve, reject) => {
406 setTimeout(
407 () => {
408 if (Math.random() < errorRate) {
409 return reject(
410 new Error(JSON.stringify({ fetchTodoById: { id } }, null, 2)),
411 )
412 }
413 resolve(list.find((d) => d.id === id))
414 },
415 queryTimeMin + Math.random() * (queryTimeMax - queryTimeMin),
416 )
417 })
418}
419
420function postTodo({ name, notes }: Omit<Todo, 'id'>) {
421 console.info('postTodo', { name, notes })

Callers 1

EditTodoFunction · 0.85

Calls 3

rejectFunction · 0.85
resolveFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…