Repository navigation
docs: enhance docs/server/non-json-content-types page - #6780
Conversation
WalkthroughThe documentation is updated to provide comprehensive examples and explanations for supporting non-JSON serializable content types in tRPC. It covers client transformer configuration, server-side request body parsing, and handling of binary data inputs, including changes to example procedure signatures and the addition of new explanatory sections. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant tRPC_Server
participant Middleware
Client->>tRPC_Server: Send request (with FormData or binary input)
tRPC_Server->>Middleware: Check Content-Type, selectively apply body parser
Middleware-->>tRPC_Server: Parsed input (FormData, binary, etc.)
tRPC_Server->>tRPC_Server: Route to mutation procedure (handles FormData or binary)
tRPC_Server-->>Client: Response
Possibly related PRs
Suggested labels
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@tresorama is attempting to deploy a commit to the trpc Team on Vercel. A member of the Team first needs to authorize it. |
@trpc/client
@trpc/react-query
@trpc/next
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
docs/server/non-json-content-types pagedocs/server/non-json-content-types page
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
www/docs/server/non-json-content-types.md (1)
55-57: Refine TypeScript capitalization and clarity.
- Capitalize “TypeScript” instead of “typescript” for consistency.
- Rephrase “your tRPC client link defines
transformer” to something like “your tRPC client link configuration includes the sametransformerused by the server.”
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
www/docs/server/non-json-content-types.md(4 hunks)
🔇 Additional comments (2)
www/docs/server/non-json-content-types.md (2)
128-128: Use.mutation()for FormData-based procedures.Switching from
.query(...)to.mutation(...)correctly reflects that FormData operations generally have side effects. This update is appropriate.
155-155: Use.mutation()for binary/file uploads.Changing the
uploadprocedure to.mutation(...)aligns with side-effectful operations (file uploads). This looks good.
| url, | ||
| transformers: superjson, // or your other transformer | ||
| }), |
There was a problem hiding this comment.
Fix property name for the batch link transformer.
The httpBatchLink option should be transformer (singular), not transformers. With the wrong key, your transformer will be ignored.
Apply this diff:
false: httpBatchLink({
url,
- transformers: superjson, // or your other transformer
+ transformer: superjson, // or your other transformer
}),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| url, | |
| transformers: superjson, // or your other transformer | |
| }), | |
| url, | |
| transformer: superjson, // or your other transformer | |
| }), |
🤖 Prompt for AI Agents
In www/docs/server/non-json-content-types.md at lines 81 to 83, the property
name for specifying the transformer in the httpBatchLink options is incorrectly
written as `transformers`. It should be `transformer` (singular). Change the
property name from `transformers` to `transformer` to ensure the transformer is
correctly applied and not ignored.
|
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. |
🎯 Changes
body parsing errorssplitLinkand server usestransformerquery, now they usemutation✅ Checklist
Summary by CodeRabbit