Type of the items.
Type of the result, the list of items by default.
Query to resolve.
Optionalsignal: AbortSignal
Aborted when the result is no longer needed; undefined
when the caller has nothing to abort.
const reader: QueryItemsReader<User> = (payload, signal) =>
fetch("/users", { body: JSON.stringify(payload), method: "POST", signal }).then((a) => a.json());
const countReader: QueryItemsReader<User, number> = (payload, signal) =>
fetch("/users/count", { body: JSON.stringify(payload.filters), method: "POST", signal }).then((a) => a.json());
Function that resolves a QueryItemsPayload into a result: the items matching it, or anything else derived from it (e.g. the total count a pagination needs). A
DataSourcereads through one; thein-memoryfolder ships readers over a plain array.The optional
signalis aborted when the read the reader serves is superseded by a newer one (or the data source is disposed): hand it tofetchto cancel the request, or ignore it, the data source discards the result of a superseded read anyway. Every reader written for the first parameter only keeps working.