-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Multi Splitlink POC #6370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Multi Splitlink POC #6370
Conversation
This PR was not deployed automatically as @Nick-Lucas does not have access to the Railway project. In order to get automatic PR deploys, please add @Nick-Lucas to the project inside the project settings page. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces significant changes to the splitLink functionality in tRPC, enabling string-based routing alongside boolean conditions while modifying the SOA example to demonstrate these changes.
- Modified
packages/client/src/links/splitLink.ts
to support string-based routing keys, though type safety concerns exist with assertions and potential runtime errors - Changed
examples/soa/client/client.ts
to use splitLink instead of custom link implementation for server routing - Updated
examples/soa/server-a/router.ts
andserver-b/router.ts
to be async procedures with modified return types - Added new test cases in
packages/client/src/links/splitLink.test.ts
for string-based routing validation - Breaking changes in API design make this incompatible with existing implementations, requiring careful consideration before merging
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
6 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
options: Record<string, TRPCLink<TRouter> | TRPCLink<TRouter>[]>; | ||
}, | ||
): TRPCLink<TRouter> { | ||
type $OptionRecord = Record<any, TRPCLink<TRouter> | TRPCLink<TRouter>[]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Using Record<any, ...> loses type safety. Consider using Record<string, ...> or a more specific type.
This can't merge as is because it's a breaking change to splitLink, but I couldn't figure out how to keep the original behaviour while adding this because mapped types and records weren't playing nicely when intersected with the condition method. Also supporting booleans adds significant complexity (retained in this draft) which is probably not worth it
🎯 Changes
What changes are made in this PR? Is it a feature or a bug fix?
✅ Checklist