Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
Diagnostics ComparisonDetailsNumbers
Timings and averages
unstable timingsUnstable
|
| @@ -1,4 +1,4 @@ | |||
| import { AnyRouter } from '@trpc/server'; | |||
| import { AnyRouter } from '@trpc/server/unstableInternalsExport'; | |||
There was a problem hiding this comment.
Should we rename it to TRPCRouter?
There was a problem hiding this comment.
- rename it
- deprecate and alias old
| import { transformResult } from '../shared/transformResult'; | ||
| import { | ||
| AnyRouter, | ||
| inferRouterError, |
There was a problem hiding this comment.
Can change it if people ask for it
| import { observable } from '@trpc/server/observable'; | ||
| import { | ||
| AnyRouter, | ||
| callProcedure, |
There was a problem hiding this comment.
We should have a public way of doing this as it's nice for RSC
There was a problem hiding this comment.
Don't you use router.createCaller() for that?
There was a problem hiding this comment.
That said, we should deprecate router.createCaller and create a createCaller(x) instead
There was a problem hiding this comment.
createCaller doesnt play very nice as a client if you have async context.
createTRPCClient with custom link using callProcedure is the best I've found
There was a problem hiding this comment.
Could you add an example of this within the tRPC repo somewhere so I can understand it better?
There was a problem hiding this comment.
This shows pretty well why it's not the best ergonomics when using createCaller.
The two accomplishes the exact same thing but the client doesn't require nested awaits.
We could probably make something that's even better though, like allowing createCaller to accept a function, and then that'd be called at the same time as the actual procedure. Since you can wrap it in cache, it'd still be de-duped.
const trpc = appRouter.createCaller(createContext);
const post = await trpc.post.all();There was a problem hiding this comment.
although you'd still miss things like having the loggerLink etc, maybe we want a like... client but that doesn't have the .query or .mutation at the end, since that has no effect when you're not doing http requests.
| export type { | ||
| AnyRouter as AnyTRPCRouter, | ||
| /** | ||
| * @deprecated use `AnyTRPCRouter` instead | ||
| */ | ||
| AnyRouter, | ||
| } from './core'; |
# Conflicts: # packages/client/src/links/wsLink.ts
# Conflicts: # .wip/changes.md # packages/client/src/TRPCClientError.ts # packages/react-query/src/shared/hooks/createHooksInternal.tsx # packages/tests/server/___testHelpers.ts
|
I think #5101 is a better approach - closing, might re-open later |
|
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. |
Closes #
π― Changes
Remove a bunch of external imports
ref #3496:
β Checklist