Skip to main content

API Reference

QueryManager

Constructor Options

interface QueryManagerOptions<T, F> {
name: string
queryClient: QueryClient
listFn?: (limit: number, offset: number, filters?: F) => Promise<T[]>
retrieveFn: (id: QueryItem['id']) => Promise<T>
createFn: (data: Partial<T>) => Promise<T>
updateFn: (data: Partial<T>) => Promise<T>
deleteFn: (id: QueryItem['id']) => Promise<unknown>
listLimit?: number
useListEffect?: (query: any) => void
}

Methods

  • useList(options?): List query with infinite scroll
  • useRetrieve(id, options?): Single item query
  • useCreate(options?): Create mutation with optimistic updates
  • useUpdate(options?): Update mutation with optimistic updates
  • useDelete(options?): Delete mutation with optimistic updates
  • prefetchRetrieve(id, options?): Prefetch single item