@monarcode/effetch-query
The core entry point: its namespaces, and the two names it exports at the top level.
@monarcode/effetch-query is the core entry point. It has no framework in it, so it works in React, React Native and code with no UI at all. It exports six namespaces, each with a page of its own, and two names at the top level. Import what you use:
import {
,
,
,
,
,
,
,
type Register,
} from "@monarcode/effetch-query";Namespaces
Query: defining queries, keys and targets, and the cache from Effect.InfiniteQuery: queries that load a list one page at a time.Mutation: defining and running mutations.Entity: records whose every cached copy a write updates.QueryClient: the client, its options and hooks, and server rendering.Signals: where a client hears about focus and reconnects.
Its two top-level names follow, grouped by the guide that covers them, each with its docs. Your editor shows the same docs, with an example, when you hover the name.
Register your services
Guide: 1. Describe your API.
Register
Declares the services your queries and mutations run with. Augment it once, next to your composition root, and every definition, client hook and QueryClient.runPromise is typed against it:
QueryClient.makerequires a layer or a runtime that provides these services.- An Effect that needs a service outside them doesn't compile.
Without the augmentation, QueryClient.Services is never, so anything that needs a service fails to compile.
Suspense and error boundaries
Guide: Suspense and error boundaries.
QueryFailure
Thrown by useSuspenseQuery and useSuspenseInfiniteQuery (from @monarcode/effetch-query/react) to the nearest error boundary when a query fails with no earlier value to show (a failed refetch keeps showing the last success instead), or when a reader's select throws. It carries the query, so the boundary can refetch it with useResetQueryFailure, and the full Cause. Tell it from other errors with QueryFailure.is. Code outside React never sees it: there, a query's failure keeps its own error type.