Skip to content

feat!: greenfield rewrite on a promise kernel, with load() handles and opt-in behaviors - #230

Merged
KATT merged 98 commits into
mainfrom
cursor/greenfield-rewrite-0833
Nov 8, 2026
Merged

KATT merged 98 commits into
mainfrom
cursor/greenfield-rewrite-0833

Conversation

@KATT

@KATT KATT commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Why

  • Loaders should start every query before awaiting any, and hand components plain handles (KATT/react-query#8).
  • Apps should ship only the query behaviors they use, with no Effect runtime in the published packages.

What

  • @raf-query/core: a promise cache (deduped requests, staleness computed on read, gc) with opt-in links (retry(), timeout()), features (focusRefetch(), reconnectRefetch(), polling(), groups(), invalidateOnAction()) and /hydration and /groups subpaths.
  • load() resolves to [handles, data]; prefetchEntry, ensureEntry and fetchEntry pick how each query waits. Verbs are free functions.
  • useQuery(factory, handle) returns [thenable, state] for every handle, and components read it with const post = use(postThenable) on its own line. The cache can drop a query between the loader and the render (gc, resetOne, removeOne), so no handle promises data, and there's one QueryHandle type. The data a loader waited for is load's second element. Switching on the thenable's status is the non-suspending read, the equivalent of TanStack's useQuery().
  • Paged queries read with useInfiniteQuery(factory, handle), whose state adds fetchNextPage(), hasNextPage, isFetchingNextPage and their previous-page twins. useQuery takes only factories that aren't paged, so apps that never page don't ship page params (−0.15 kB on the base); passing the wrong kind to either hook is a type error.
  • Both hooks track the state fields a component reads while rendering, like TanStack's tracked result: a write re-renders it only when its thenable changes or settles, or a field it read changes. A component that reads only the thenable doesn't re-render while a refetch starts and ends. The state object keeps its identity until then, and refetch() / fetchNextPage() keep theirs while it's mounted.
  • Structural sharing keeps an own "__proto__" key (which JSON.parse produces) as data: it never reads or sets a prototype through it.
  • @raf-query/react (hooks, providers, TanStack Router integration, devtools) and @raf-query/boundary (QueryBoundary for typed fail() errors). Boundary's first npm publish is manual (DEVELOPMENT.md).
  • A server client belongs to one request. staleTime doesn't apply there: every entry reuses the request's data, and fetchEntry refetches only what a write invalidated. action() never reaches a server client, and a useQuery read of a disabled query returns a rejected thenable, which Suspense hands to the browser.
  • action(write, { client }) binds an action to one browser client, for pages that mount several, and checks its targets against that client's root. Without client, every mounted browser client with invalidateOnAction() reacts.
  • The hooks stay correct when an app compiles them with the React Compiler (Next.js transpilePackages with reactCompiler): reads of an entry take its state snapshot from useSyncExternalStore, which core replaces on every write, and the read-field tracker lives in useState.
  • The published sources typecheck without @types/node, and inline generic factory makers infer their own types in entries, waterfallHandle and verbs.
  • Every key comes from a group: group("posts") and group(posts, "drafts") return a callable, and drafts("byId", input) builds the plain array ["posts", "drafts", "byId", input]. queryOptions takes only a key a group built (a hand-written key is a type error), and a group matches every key that starts with its path. In development, a subgroup and a query sharing a name under one parent throw; production builds drop the check. group() costs 152 B gzip in production on its own, 62 B next to core, and prefix matching keeps core 48 B under the object groups it replaces. Tags live in meta. Keys, groups and tags are provisional and need sign-off.
  • Every object literal bound to a variable in the examples, docs samples, demos and tests has a type, by annotation or satisfies, such as const mentionsTodo: Target<QueryMeta, number> = { … }. workspace/no-untyped-object-literal enforces it there and in Markdown fences, and AGENTS.md states the rule.
  • pnpm bundle-size (a CI job) bundles one entry per slice and fails if an unused feature lands in a bundle, or if the base passes 5 kB gzip (all entries). TanStack Query's defaults are opt-in here:
Bundle (gzip, React external) Size
Base: a client, load, useQuery, group() 4.47 kB
TanStack defaults: the five below together 5.50 kB (+1.03 kB, +23%)
HydrationBoundary alone +0.41 kB
retry() alone +0.29 kB
polling() alone +0.22 kB
focusRefetch() alone +0.15 kB
reconnectRefetch() alone +0.12 kB
A paged query (useInfiniteQuery) +0.66 kB

Alone the five TanStack defaults sum to 1.19 kB; together they share code, so they cost 1.03 kB. Tracked state costs 0.31 kB of the base.

const qc = createQueryClient({ ...recommended(), staleTime: 5000 });
const [handles] = await load(qc, {
	comments: prefetchEntry(commentsQuery, { slug }),
	post: ensureEntry(postQuery, { slug }),
});
await invalidateMany(qc, posts); // posts = group("posts")

// In a component
const [postThenable, postState] = useQuery(postQuery, handles.post);
const post = use(postThenable);

Links

Where Preview
Docs Quick start · Starting queries › prefetchEntry or ensureEntry? · Handles › Reading a handle · Comparison › Reading without Suspense · Query keys › Groups · Invalidation › Targets · Invalidation › Matching with where · Invalidation › Invalidate, reset or remove · Mutations › One client among several · Query functions › Expected errors · Infinite queries › Reading pages · Render optimizations › Tracked state · API reference › Reading queries
Next.js Issue list (prefetch)
TanStack Start Issue detail (ensure)
React Router Issue detail (fetch)

Alternatives considered

  • TanStack query-core underneath: its retryer, focus and online managers and observers ship in every bundle, so the base can't stay under 5 kB.
  • Effect behind a subpath: the published packages stay free of Effect.
  • Native Observable with a ponyfill: only Chromium ships it.
  • A useQuery that returns the data itself for a handle the loader waited for: the cache can drop the query before the render, so it had to suspend inside the hook anyway, and one hook had two return shapes.
  • One reading hook for both kinds of query: its state type changed shape with the factory, and every app shipped page params.

Testing

  • pnpm test (core, react and boundary at 100% coverage, plus type tests for handles, roots, targets, meta, bound actions, inline factory makers and group-built keys; type tests that each hook rejects the other kind of factory; a loaded handle reads without suspending and suspends again once the cache dropped it; reading by switching on the thenable's status; render-count tests that a refetch with equal data keeps the thenable, the state object and its functions; the React Router example checks its client spreads recommended(); the hooks also run through babel-plugin-react-compiler, checking that every write and every page renders, that a write to a field the component didn't read doesn't re-render it, a write to one it read does, and a field first read in a later render is tracked from then on) and pnpm bundle-size.
  • pnpm typecheck also typechecks each package's shipped sources with no ambient types, and the docs samples' .tsx files that share a name with a .ts file.
  • The lint rule's tests hold every JS/TS fence in the repo's Markdown to it.
  • The three example apps, driven with the verify-examples skill after tracked state: list counts, filter and sort, the dimmed previous list while a filter loads, Load more skeletons and infinite scroll to 42 of 42, row links, issue detail previous/next and skeletons, back to the list, server-rendered comments and posting one (25 checks per app, all passing). The docs demos for isFetching per card with refetch() and useIsFetching(), the cancellation demo's Refetch button, polling, and whilePending: "previous" pagination show and clear their indicators.
  • The structural sharing property test runs the "__proto__" shapes fast-check draws about once in 2000 values as fixed examples; a plain test checks the key stays data.

AI model

Claude Opus 5.5

Open in Web Open in Cursor 

cursoragent and others added 16 commits November 6, 2026 14:43
…eatures

Groups, tags and keys follow Design 1 of the keys design and are provisional.
Hydration moves to an opt-in subpath. The core no longer depends on Effect.

Co-authored-by: alexander <[email protected]>
…t races

Also fix bugs the tests found: retry waited forever for an online event in
runtimes whose navigator has no onLine, new entries scheduled gc with the
default gcTime, and factories with a required input didn't fit QueryFactory.
Lint bans importing Effect from published packages.
useQuery reads handles (data for defined handles, a thenable otherwise),
with result: true and whilePending: previous. HydrationBoundary has a
react-server build; QueryProvider marks RSC SSR clients browser-only.
/tanstack-router streams dehydrated entries without Effect. QueryBoundary
catches fail() tags with handlers typed from the query.
Core matches two kinds of invalidation target: factories (by identity, with an
optional partial input) and objects with a typed `where`. Groups and tags move
to the optional `@raf-query/core/groups` subpath (re-exported as
`@raf-query/react/groups`); tags need its `groups()` feature.

Root types come from the root's parts: `link<{ meta }>()` and
`feature<{ meta }>()` declare the meta fields they read, `createQueryClient`
intersects them, and factories name their root with
`def: defType<typeof makeQueryClient>()`. The per-query `retry` and
`refetchInterval` options move into the meta that `retry()` and `polling()`
declare.

Handles and dehydrated entries carry keys as plain data, since a group holds a
function. Provisional: the design is unconfirmed.
Loaders and server components start queries with load() and
prefetchEntry/ensureEntry/fetchEntry, clients come from createQueryClient with
recommended(), and writes invalidate the issues group with invalidateMany.
focusRefetch() and reconnectRefetch() declare meta.refetchOnWindowFocus and
meta.refetchOnReconnect, read the way polling() reads meta.refetchInterval.
group("drafts", posts) returns a frozen { group: "posts/drafts" }, branded
only in the types, and core matches a group target as a prefix of the key's
first segment. Keys look the same in memory, on the wire and in devtools, so
handles and dehydrated entries carry them as they are. where targets remain
for tags and predicates, which read meta and never enter keys.
…new API

Bundle-size drops the TanStack-backed and Effect columns, adds a hydrated
scenario, and fails when raf-query's client-only base passes 5 kB gzip.
Publish @raf-query/boundary with the other packages, and drop the Effect
example and experiments from CI, knip and the PR template.
Effect scope, the kernel and its subscribe, hydration opt-in, load and
handles, free-function verbs, typed errors, streams, links and features
with declared meta, action invalidation, the bundle budget, and the
provisional keys, groups and tags design.
@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
raf-query Ready Ready Preview Nov 8, 2026 9:00pm UTC
raf-query-tanstack-start-effect Ready Ready Preview Nov 8, 2026 9:00pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
raf-query-nextjs Ignored Ignored Preview Nov 8, 2026 9:00pm UTC
raf-query-react-router Ignored Ignored Preview Nov 8, 2026 9:00pm UTC
raf-query-tanstack-start Ignored Ignored Preview Nov 8, 2026 9:00pm UTC

Request Review

…he server

Routers throw a Response for a redirect, which retry() retried three times
before navigating. useIsFetching's server snapshot could put a nonzero
count in the HTML that the browser's first render didn't match.
…tures tree-shake away

Each fixture imports one slice (core, React hooks, hydration, retry(),
polling(), focus/reconnect refetch, groups(), streams, QueryBoundary,
everything). The run fails when a bundle holds an opt-in feature its entry
doesn't import, and when the base passes 5 kB gzip. CI runs it.
KATT and others added 28 commits November 8, 2026 17:32
…idate

The `load` entry builders take their names from HTTP `Cache-Control`, so
they no longer reuse "entry", which means a cache entry everywhere else in
core:

- `prefetchEntry` -> `prefetch`: start the query if it isn't fresh, don't wait.
- `ensureEntry` -> `swr` (stale-while-revalidate): wait only when nothing is
  cached; stale data resolves at once and refetches in the background.
- `fetchEntry` -> `revalidate` (must-revalidate): wait unless the cached data
  is fresh (`staleTime` is the max-age). Fresh data isn't refetched.

`LoadEntry` kinds (and the devtools' Loads list) are
`"prefetch" | "swr" | "revalidate"`, and `EntryOptions` is
`LoadEntryOptions`. Internally `load.ts` calls `fetchEntry` from `entry.ts`
by its name, and the old internal `prefetch(entry)` is `startIfStale`.

The example apps' loader verbs and routes follow: `/ensure/…` is `/swr/…`
and `/fetch/…` is `/revalidate/…`, as are the docs demo's variants. Docs,
samples, READMEs, the verify-examples feature map and .agent-docs use the
new names; starting-queries.md links the two Cache-Control directives.

Bundle: most entries +0.01 kB gzip (base 4.47 -> 4.48 kB).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`setData(client, factory, updater)` writes a query whose factory takes no
input (or an optional one), so the docs no longer pass `undefined`:

    setData(queryClient, todosQuery, (data) => …);

The form follows the factory's parameters: a factory with a required input
still takes `setData(client, factory, input, updater)`, and one with no
parameter takes only the short form, as the other verbs give it no input
slot. At runtime the two differ by argument count, since the data itself
may be a function.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A factory target's partial (`invalidateMany(qc, factory, partial)` and
`[factory, partial]` in `invalidateMany`, `resetMany` and `removeMany`
lists) is part of the factory's input: `PartialInput<F>` is
`DeepPartial<InputOf<F>>`, and matching compares it with the input the
factory was called with. Before, it matched the key's last segment, so with
`queryKey: posts("bySlug", input.slug)` the partial had to be `"hello"`
rather than `{ slug: "hello" }`.

A hydrated entry has no factory or input until it's read, as before: a
factory target invalidates it from its first read, and `resetMany` /
`removeMany` skip it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On any server client, a render never starts a request: only loaders and
server components do. A read with no data, no error and no request in
flight (a `waterfallHandle`'s query, a disabled query, one the cache
dropped) rejects with an error carrying Next.js's client-rendering digest,
so `use()` renders the nearest Suspense fallback on the server and the
browser loads the query. Disabled reads use the same path instead of
rejecting with `QueryDisabledError`. In TanStack Start, a query no loader
started now shows its fallback in the HTML instead of rendering there.

`QueryProvider` and the client's `~browserOnly` flag are gone: every
framework renders `QueryClientProvider client={…}`. The docs show one
`Providers` client component that takes a router's client or creates one
per server render and per browser tab.

`isBrowserRenderError` tells the bail-out apart from real errors. TanStack
Start's default stream handler logs it and React Router's default
`entry.server.tsx` answers 500, so the Start and React Router examples
ship server and client entries that skip it.

Under the `react-server` condition, `useQuery`, `useInfiniteQuery`,
`useIsFetching` and `useQueryClient` throw an error that says they belong
in client components.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tags (`tag`, `groups()`), hydration (`dehydrate`, `dehydrateStream`,
`hydrate`, `canDehydrate`, `RedactedError`) and the devtools
(`QueryDevtools`, `QueryDevtoolsPanel`) are exports of `@raf-query/react`'s
main entry, and tags and hydration of `@raf-query/core`'s. The `/groups`,
`/hydration` and `/devtools` subpaths are gone: import from
`@raf-query/react` (or `@raf-query/core`) instead.

`@raf-query/react/tanstack-router` stays a subpath: it imports from the
optional peer `@tanstack/react-router` and ships different code to the
server and the browser. `@raf-query/core/internal` stays for the bindings.

Both packages keep `"sideEffects": false`, and the folded modules do no
work at import time, so apps that don't use tags, hydration or the
devtools bundle none of them: `pnpm bundle-size` shows every other entry
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ging

- The quick start is a post and its comments: `swr(postQuery, { slug })`
  and `prefetch(commentsQuery, { slug })` in the loader, the post read with
  `useQuery` + `use()`, the comments with `useInfiniteQuery` + `use()` and a
  "Load more" button, and adding a comment as a plain React action that
  awaits the write, then `invalidateMany(queryClient, [[commentsQuery, { slug }]])`.
- The quick start and the handles page say why `useQuery` takes the factory
  as well as the handle: the handle is plain data, and can't carry `queryFn`.
- The request waterfalls page uses the post's author as its dependent query.
- No sample or demo fakes paging with `nextCursor: null` any more: lists that
  aren't paged are plain `queryOptions` lists. The quick start's todo route
  and form are gone; `todosQuery()` stays as a plain list where a page is
  about todos.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `useQuery`'s second slot is typed `QueryState<F>`, and
  `useInfiniteQuery`'s `InfiniteQueryState<F>`, matching the `postState`
  variables the docs, samples and examples already use.
- The docs call it the query's state; the reading queries page's
  "Controls" section is "State".
- Inside `@raf-query/react`, the entry's state is core's `EntryState`
  instead of a local `State` alias.

BREAKING CHANGE: `QueryControls` is `QueryState`, and
`InfiniteQueryControls` is `InfiniteQueryState`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `waterfallHandle(factory, handle, (input) => nextInput)` derives a handle
  from another one: the updater gets the handle's current input and returns
  the new one, so render-time state merges into a loader's input:
  `waterfallHandle(searchQuery, props.search, (input) => ({ ...input, q }))`.
- While the new input's key hashes the same as the handle's, it returns the
  original handle object, so `useQuery` keeps reading the loader's handle.
- A plain value as the third argument is a type error.
- The URL state page shows it for a search box, and the API reference and
  handles page list it. The URL state page's sample names its state
  `postState`.

BREAKING CHANGE: `waterfallHandle(factory, handle, input)` is
`waterfallHandle(factory, handle, () => input)`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `@raf-query/core` (and `@raf-query/react` through it) keeps `link`,
  `feature`, `Link`, `Feature`, `Operation`, and `Target` / `QueryInfo` for
  targets, plus the app-facing `QueryClient`, `QueryClientConfig`,
  `QueryMeta`, `Clock` and the bound builders' types.
- `Decl`, `RootTypes`, `DefaultTypes`, `MetaOf`, `RootOf`, `AnyLink`,
  `AnyFeature`, `ClientEvent`, `systemClock`, `EntryState`, `AnyFactory`,
  `AnyTarget` and the built-in parts' `*Meta` declarations move to
  `@raf-query/core/internal`, which `@raf-query/react` imports them from.
- A type test writes a link, a feature that declares `meta`, and a target
  next to `groups()` and `tag`, with public exports only.
- The API reference drops the internal types, and the links and features
  docs list what a package that ships one needs.

BREAKING CHANGE: the types above are no longer exported from
`@raf-query/core` or `@raf-query/react`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The first item: reading a query with `useQuery` never refetches stale
  data when a component mounts, because loaders decide freshness. Stale
  data refreshes when the next loader starts it, on invalidation, on focus
  and reconnect, and through polling.
- The comparison page's API map has a row for TanStack Query's refetch of
  stale data on mount.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… components

A server render leaves a query nothing started (a `waterfallHandle`'s
query, one the cache dropped) to the browser only on a client fed by
server components. The server components' `HydrationBoundary` marks the
client components' server client through `Hydrate` before its children
render; below it, such a read renders the nearest Suspense fallback and
the query loads in the browser, as before. Everywhere else a server
render fetches it while rendering again: TanStack Start streams the
entry to the browser, and in React Router the browser fetches it once
more, since loader snapshots carry only what loaders started.

A client component that renders before the first `HydrationBoundary`
still fetches on the server. Disabled reads on any server client still
reject with the client-rendering digest.

The Start examples' custom `server.ts` / `client.tsx` and the React
Router `entry.server.tsx` / `entry.client.tsx` are gone, with the
`isbot` and `@react-router/node` dependencies only they used, and so is
`isBrowserRenderError`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Core already has the general mechanism tags were built on: a target is
any object with `where(query, param)`, `query.meta` is passed in, and a
setup-less `feature<{ meta: … }>()` declares typed `meta` for a client.
So `groups()`, `tag`, `Tag` and `TagsMeta` leave core, along with their
bundle-size scenario and `".tags"` marker.

The docs show tags as a short recipe in app code
(query-invalidation.md#tags): a `tagged` feature that declares
`meta.tags`, a `tag(name)` target, and a variant that takes the tag as
its parameter. `tags-recipe.test.ts` runs the recipe and checks that
`meta.tags` and the targets type only on a client with the feature.

Bundle size: "Everything" goes from 6.91 to 6.76 kB gzip; every other
entry is unchanged.

BREAKING CHANGE: `groups()`, `tag()` and the `Tag` type are no longer
exported from `@raf-query/core` or `@raf-query/react`, and `TagsMeta`
is gone from `@raf-query/core/internal`. Write tags in app code with
`feature()` and a `where` target (see the Query invalidation docs);
`meta.tags` computed from data becomes a `where` that reads
`query.data`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ent the internals

Each opt-in behavior or distinct mechanism in packages/core/src gets a
folder with its implementation and its test: links/retry, links/timeout,
features/focus-refetch, features/reconnect-refetch, features/polling
(sharing features/shared.ts), hydration, infinite, structural-sharing,
and keys (keys.ts with group() and hashKey, targets.ts with stamps and
matching, plus the tags recipe test). The kernel stays flat. presets.ts
imports from the folders.

Tests move next to the code they test, and each test file opens with a
comment on how the behavior works inside: what it is, what it reads from
meta or options, what it subscribes to or wraps, and what it writes to
the cache. Shared helpers (cached, counted, flaky, loadOne) move to
test-utils.ts. The same 105 tests run, and coverage stays at 100%.

Streams stay in entry.ts: a streams/ module would import the entry that
calls it, a cycle knip rejects. group() stays in keys.ts because a
separate group.ts lands later in the bundle and moves entries by a few
bytes.

The public API and package exports are unchanged. Every bundle-size
entry is byte-identical. The bundle-size markers now name the behavior
modules instead of strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `load(qc, { drafts: cond ? prefetch(draftsQuery, input) : skipToken })`
  starts nothing for a skipped entry: its handle is `undefined` and `data`
  has no key for it. Readers render only when there's a handle, and
  `useQuery` keeps requiring one.
- `enabled`, `isEnabled` and `QueryDisabledError` are gone, and so is the
  disabled-read path on the server: a server render rejects only reads of
  unstarted queries in a client fed by server components.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
…ydration

- Replace "Disabling a query" with "Conditional queries" in starting-queries.md: `skipToken` in place of a `load` entry, an `undefined` handle, rendering the reader only with a handle. New sample `starting-queries.conditional-queries.tsx`.
- Rework "Browser-only queries" (ssr-and-hydration.md) and the comparison page's notification-permission sample: the handle is a `waterfallHandle` built once in a child that renders after TanStack Router's `useHydrated()`, so the `queryFn` never runs on the server.
- Drop `enabled` and `QueryDisabledError` from the API reference, important defaults, query factories, client state and comparison pages; add `skipToken` to the API reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
…nt docs

- `decisions/skip-token.md` replaces `decisions/enabled.md`: no `enabled`, `skipToken` skips a `load` entry, browser-only data is a waterfall handle built after hydration.
- Drop `enabled` and disabled reads from core-behaviors, server-renders-start-no-requests, docs-async-cache-framing and docs-home-tanstack-leave-outs; resolve the disabled-query question in the PR #230 review notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
The caching, cancellation, invalidation, optimistic updates, starting
queries and waterfalls demos read their lists with `infiniteQueryOptions`
and `useInfiniteQuery` again. Each fake server returns a page from
`cursor` with a `nextCursor` computed from the data (`pageOf` in the demo
kit), `null` only on the last page, and each list has a "Load more"
button (`LoadMoreButton`) that goes away after the last page. The
optimistic updates demo lists newest first, so a new todo lands on the
first page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
- `todosQuery()` is `infiniteQueryOptions` again, on `listTodoPage`,
  which returns a `TodoPage` from `cursor` with the API's `nextCursor`.
- The mutations page's cache update patches the todo inside `pages` and
  keeps `pageParams`, and says why.
- The query keys sample's todo and archived lists, the query functions
  intro's todo list and the one-input-serializable sample's issue list
  page from `cursor: 0` with the API's `nextCursor`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
The human wants the lists that faked paging back on
`infiniteQueryOptions`, paging like tRPC's infinite queries: a real
`nextCursor` from the API, `null` only on the last page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
Typed errors and the boundary package move to a PR stacked on this one,
to keep this PR reviewable. The stacked PR brings them back by reverting
this commit.

Removed:
- `packages/core/src/fail.ts`: `fail()`, `Fail`, `QueryFailure`,
  `isQueryFailure`, `isFail`, `failOf`, `Result`, and their exports from
  `@raf-query/core` (and so `@raf-query/react`).
- `ErrorOf` and the fail type slot of `QueryOptions` and
  `InfiniteQueryOptions`: a factory's data type is the `queryFn` result.
- Fail handling in the entry, paged queries, hydration (`fail` in
  dehydrated entries and results; `canDehydrate` sends entries with data
  or a request in flight) and `retry()`. Thrown server errors still cross
  hydration as a `RedactedError`, and `retry()` still skips thrown
  `Response`s.
- `useQuery` and `useInfiniteQuery`'s `{ result: true }` option.
- The `@raf-query/boundary` package (`QueryBoundary`), its bundle-size
  scenario, release step, knip entry and docs.
- The "Expected errors" docs section and its sample, and every mention
  in the docs pages.

Agent docs: `.agent-docs/decisions/typed-errors-stacked.md` records the
move and the stacked PR's follow-ups; decisions that describe typed
errors or the boundary say they live in the stacked PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
`prefetch-or-swr`, `waterfallHandle`, and `skipToken`'s "Conditional
queries" in place of main's `prefetch-or-ensure`, `useWaterfall` and
"Disabling a query".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
…s and comments

The caching demo pages through posts, the invalidation demo reads posts
lists by sort next to an authors list, and the optimistic-updates demo adds
a comment to a post's paged comments, newest first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
feedQuery (a paged posts list) and listPostPage take over from todosQuery
and the todo API. setData patches a post's title inside pages, the
optimistic form adds a comment, query keys use posts and drafts, and the
pages that show these snippets match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
search.test.ts and popup-docs.test.ts bound untyped object literals,
which workspace/no-untyped-object-literal rejects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67eUtiQ2KT6FwW8ftCf
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This is included in version v0.12.0 🎉

The release is available on:

Cheers! 📦🚀

This branch was successfully deployed

5 active (3 outdated) deployments
Preview – raf-query — e0071ef5 Deployed Nov 8, 2026 by vercel[bot]
Preview – raf-query-tanstack-start-effect — e0071ef5 Deployed Nov 8, 2026 by vercel[bot]
Preview – raf-query-react-router — 42cc42a7 Deployed Nov 8, 2026 by vercel[bot]
Preview – raf-query-tanstack-start — 42cc42a7 Deployed Nov 8, 2026 by vercel[bot]
Preview – raf-query-nextjs — 42cc42a7 Deployed Nov 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants