docs: simplify tanstack start handlers to use ANY method#1189
docs: simplify tanstack start handlers to use ANY method#1189dinwwwh merged 2 commits intomiddleapi:mainfrom
Conversation
|
@Visualizeit is attempting to deploy a commit to the unnoq-team Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @Visualizeit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the clarity and conciseness of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
WalkthroughPer-route HTTP method handlers (HEAD, GET, POST, PUT, PATCH, DELETE) were replaced with a single async Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant R as Router (ANY)
participant H as Existing Handler (handler.handle)
rect rgb(230, 247, 255)
C->>R: HTTP request (any method)
R->>H: forward request + prefix/context
H-->>R: { matched, response } or undefined
R-->>C: response or 404
end
%% Comparison: old vs new (simplified)
sequenceDiagram
participant C as Client
participant OldR as Router (per-method)
participant NewR as Router (ANY)
participant H as Handler
Note over C,OldR: Old flow
C->>OldR: HTTP request (GET/POST/...)
OldR->>H: method-specific handler invocation
H-->>OldR: response
OldR-->>C: response
Note over C,NewR: New flow
C->>NewR: HTTP request (any method)
NewR->>H: unified ANY handler forwards request
H-->>NewR: response
NewR-->>C: response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request simplifies the server handlers in the TanStack Start adapter documentation. The change replaces multiple specific HTTP method handlers with a single ANY handler, which makes the example code more concise and easier to understand. The change is correct and aligns with the goal of simplification. I noticed that the corresponding example in playgrounds/tanstack-start/src/routes/api/rpc.$.ts still uses the older, more verbose handler definition. While it's outside the scope of this PR, updating it in a future change would improve consistency across the project's examples.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/content/docs/adapters/tanstack-start.md (1)
38-44: Consider adding a brief note explaining the simplification.The change from enumerated method handlers to
ANYis a valid simplification, but the documentation doesn't explain the rationale or highlight that this is equivalent to the previous pattern. Adding a brief comment or expandable note would help readers understand why this pattern is preferred.Consider adding a note like:
:::info The `ANY` handler is a simplified approach that handles all HTTP methods. For cases requiring method-specific logic, individual handlers (`GET`, `POST`, etc.) can still be used. :::This can be placed after the code block to clarify the design choice.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/content/docs/adapters/tanstack-start.md(1 hunks)
🔇 Additional comments (1)
apps/content/docs/adapters/tanstack-start.md (1)
38-44: No issues found — the example correctly usesANYas a handler.TanStack Start's
server.handlersconfiguration supportsANYas a valid handler key to match all HTTP methods. The simplification from individual method handlers to a singleANYhandler is correct and well-supported by the framework.
…o a single handler
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/client
@orpc/contract
@orpc/experimental-durable-iterator
@orpc/hey-api
@orpc/interop
@orpc/json-schema
@orpc/nest
@orpc/openapi
@orpc/openapi-client
@orpc/otel
@orpc/experimental-publisher
@orpc/experimental-ratelimit
@orpc/react
@orpc/react-query
@orpc/experimental-react-swr
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-aws-lambda
@orpc/standard-server-fastify
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/standard-server-peer
@orpc/svelte-query
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/content/docs/adapters/tanstack-start.md(1 hunks)playgrounds/tanstack-start/src/routes/api/$.ts(1 hunks)playgrounds/tanstack-start/src/routes/api/rpc.$.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: publish-commit
- GitHub Check: test
- GitHub Check: lint
🔇 Additional comments (2)
playgrounds/tanstack-start/src/routes/api/rpc.$.ts (1)
23-30: Consistent implementation across RPC routes.The ANY handler implementation mirrors the OpenAPI route pattern, maintaining consistency across the codebase. The RPCHandler will handle method-specific routing internally, and the 404 fallback provides appropriate error handling.
apps/content/docs/adapters/tanstack-start.md (1)
32-39: Documentation accurately reflects the implementation changes.The updated example correctly demonstrates the simplified ANY handler pattern, maintaining consistency with the playground implementations. This makes the documentation easier to follow and reduces the example code footprint.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace multiple HTTP method handlers (HEAD, GET, POST, PUT, PATCH, DELETE) with a single ANY handler to simplify the example code.
Summary by CodeRabbit