Skip to content

feat(client): retry a part of a load: an operation for every query - #8176

Closed
KATT wants to merge 10 commits into
claude/shared-query-descriptionsfrom
claude/load-retries
Closed

KATT wants to merge 10 commits into
claude/shared-query-descriptionsfrom
claude/load-retries

Conversation

@KATT

@KATT KATT commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Why

What

  • Every query of experimental_load() is an operation through the links. One that reads another's data carries its reads in its context; a pipelining batch link puts it in that request.
  • retryLink retries a query that failed by itself; the queries that read it ride in the retry's request, and nothing before it runs again. A whole-request failure resends only the root; the rest ride along.
  • A failed run for one item becomes an operation by itself, marked so retryLink counts it as attempt 1.
  • A retry of a query the server filled in carries that input.
  • experimental_isPipelineFallback(error): lets retry skip a query that never ran because the one it reads gave up. Only pipelining makes these errors.
  • Only a pipelining batch link sees reads (undefined in the input, ~reads / ~priorFailure in the context); every other link gets complete inputs. retryLink, loggerLink and httpLink are as on main.
  • The batch links are as on main too, but for handing experimental_pipelining() their loader and handler: ~60 B gzip over main for a client that doesn't pipeline, from ~200.
a → b → c, b fails once:   /a,b,c   then   /b,c

Links

Alternatives considered

  • Re-planning each attempt inside the load, with a retry handshake: links still blind to most queries.

Testing

  • Regression check: loadRetry.test.ts "a query that fails is retried with the queries that read it, and nothing before it" (/a,b,c then /b,c; before, b failed for good).

AI model

Claude Opus 5.5

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

KATT and others added 2 commits November 24, 2026 00:47
…a part of it

Every query `experimental_load()` describes is an operation through the
links. One that reads another's data has its reads in its context; a
batch link that pipelines puts it in the request of what it reads, and an
operation that waits goes in the next attempt of what it reads. So
`retryLink` retries a query that failed by itself, the queries that read it
go in that retry's request, and nothing before it is sent again.

A run for one item that fails in the request of its list becomes an
operation by itself, marked with that failure, which `retryLink` counts as
its first attempt. `experimental_inputOf()` gives a link that doesn't
pipeline the input with what it reads filled in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`/kitchen-sink/retries` loads a post, its author and team, and a commenter
for every comment, with failures you choose. It shows each request, the
calls in it, every attempt the links see, and each query's run number, so
you can watch `retryLink` send only the part of the chain that failed.

The nested-queries docs say what links see now, document
`experimental_inputOf()`, and gain a section on retries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
examples-next-minimal-starter Ready Ready Preview Nov 24, 2026 11:51am UTC
examples-todomvc Ready Ready Preview Nov 24, 2026 11:51am UTC
next-prisma-starter Ready Ready Preview Nov 24, 2026 11:51am UTC
next-prisma-websockets-starter Ready Ready Preview Nov 24, 2026 11:51am UTC
tanstack-start-sse-chat Ready Ready Preview Nov 24, 2026 11:51am UTC
trpc-next-app-dir Ready Ready Preview Nov 24, 2026 11:51am UTC
www Ready Ready Preview Nov 24, 2026 11:51am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…nd let it send unstreamed

`loggerLink` sits after `retryLink`, so the console has each attempt of
each query. A Stream toggle sends with `httpBatchLink` instead, whose JSON
body Chrome's Network tab shows; it shows none for a streamed response.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel
vercel Bot temporarily deployed to Preview – trpc-next-app-dir November 24, 2026 00:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – next-prisma-starter November 24, 2026 00:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-next-minimal-starter November 24, 2026 00:20 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-todomvc November 24, 2026 00:20 Inactive
Once a query that read another's data has run in that request, the client
has the data it read, and so its input. `loggerLink` logs its result with
that input, and `retryLink` sends a retry as an operation like any other,
with that input: a request of its own, which the queries that read it go
in as soon as it opens.

Regression check: loadRetry.test.ts "a retry of a query the server filled
in goes with that input, as an operation like any other".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
KATT and others added 2 commits November 24, 2026 01:54
…ipeline

`retryLink`, `loggerLink` and `httpLink` are as they were. A run's failure
in the request of its list is the first attempt of its operation: the batch
link that pipelines fails that attempt with it, once, without sending it,
so `retryLink` counts it, and without one it is final. Once a query ran,
its input is written on the operation the links hold, so a retry has it.
`experimental_load()` sends what a query reads only to a link that
pipelines; any other gets filled-in inputs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… of its own

With an operation for every query, `loggerLink` logs each one, so naming
the calls of a request on its operation's line repeats them. It goes, and
with it what `loggerLink` cost a client that doesn't pipeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…skips queries that never ran

With pipelining, once a query's retries give up, the queries that read it
reject with its error, and `retryLink` asks `retry` about them too. The
check lets `retry` skip them, so they don't wait `retryDelayMs` for
nothing. Without pipelining there are no such errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ning()` wrapping their loader and handler

What a pipelined batch needs, its calls, URL and body, the opening and
closing of each operation's request and a stream kept open for the calls
that read a failed operation, is in `experimental_pipelining()`. A batch
link only hands it its loader and its handler, about 60 bytes gzipped
over `main` instead of about 200.

Each call goes in its request as the operation it is for, with a signal
that keeps the request going until the call has its result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
KATT added a commit that referenced this pull request Nov 24, 2026
…elining PR

Bring the client, server and tests from the tail of the stack (#8163,
#8176) into this PR: `experimental_query()` / `experimental_dataOf()` /
`experimental_perItem()` and `experimental_load()` in `@trpc/client`
replace `experimental_nested()`, each query is an operation of its own
so `retryLink` retries only what failed, and
`experimental_isPipelineFallback()` tells a fallback apart. Adds the
kitchen-sink retries page.

The TanStack-only parts stay in #8041: the docs here don't link to the
TanStack nested-queries page, `unstable-internals` doesn't re-export what
only the handles use, and `RequestPath` comes with them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
KATT added a commit that referenced this pull request Nov 24, 2026
Folds #8163 and #8176 into this PR: the handles load the shared
descriptions of `@trpc/client`, and the tree now matches the tail of the
stack (f4133ea), with the TanStack docs, demos and blog kitchen sink.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@KATT

KATT commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Folded into the bottom of the stack, so closing:

The branch stays.

@KATT KATT closed this Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 25, 2026

This branch was successfully deployed

5 active deployments
Preview – www — f4133ea7 Deployed Nov 24, 2026 by vercel[bot]
Preview – next-prisma-starter — f4133ea7 Deployed Nov 24, 2026 by vercel[bot]
Preview – examples-todomvc — f4133ea7 Deployed Nov 24, 2026 by vercel[bot]
Preview – trpc-next-app-dir — f4133ea7 Deployed Nov 24, 2026 by vercel[bot]
Preview – examples-next-minimal-starter — f4133ea7 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant