Repository navigation
feat(client): pass the abort signal to localLink createContext - #8027
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
- `createContext` now receives `{ signal }`, the same signal procedures
get, so slow context work can stop when the call is cancelled.
- Don't create context or run the procedure for a call that was aborted
before it started, and don't run the procedure if the call was aborted
while context was being created. Before, a cancelled mutation still ran.
- Assert that the signal procedures receive aborts with the call.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Un67dkX3ZhkgFt8euJr5b
9882643 to
64aa25f
Compare
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
Some runtimes the HTTP links already support, such as older Safari and some React Native AbortController polyfills, have no `AbortSignal.prototype.throwIfAborted`. Calling it directly made every localLink call throw a TypeError there, cancelled or not. Move the existing fallback from httpUtils into internals/signals and use it in both places. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019Un67dkX3ZhkgFt8euJr5b
Mirror the adapters, whose createContext gets the request's signal as `opts.info.signal`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019Un67dkX3ZhkgFt8euJr5b
trpc-bot
left a comment
There was a problem hiding this comment.
Reviewed: localLink now skips context creation and the procedure for a cancelled call, passes info.signal to createContext like the adapters do, and uses the shared throwIfAborted fallback. CI is green and CodeRabbit has no findings.
Generated by Claude Code
|
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. |
Why
localLinkcall is aborted. The work behind it kept going:createContextwas pending still ran the procedure once context resolved. A cancelled mutation would still write.createContextgot no signal, unlike the adapters'createContext, which getsinfo.signal.What
createContextreceives{ info: { signal } }, mirroring the adapters. Procedures already get the same signal asopts.signal. Existing() => …functions still type-check.throwIfAbortedfallback fromhttpUtils, so runtimes withoutAbortSignal.prototype.throwIfAbortedkeep working.Links
info.signal.Alternatives considered
{ signal }: simpler, but differs from the adapters'info.signal.Testing
localLink.test.ts,passes the signal to createContext,does not run the procedure when aborted during context creationanddoes not create context or run the procedure when already abortedfail without this change, for both query and mutation.AI model
🤖 Generated with Claude Code
https://claude.ai/code/session_019Un67dkX3ZhkgFt8euJr5b