spaghet
spaghet
Explore posts from servers
TtRPC
Created by spaghet on 9/17/2024 in #❓-help
Streaming is not working
Hi, I've set up unstable_httpBatchStreamLink in my app but the streaming is not working. The batching occurs, but nothing is streamed back from the server. It looks like the request still resolves after the slowest request has been sent. Can anyone help me troubleshoot this? I'm using a Fastify server.
2 replies
TtRPC
Created by spaghet on 8/16/2024 in #❓-help
Need help with performance
Hello, tRPC is still dreadfully slow for us. It's borderline unusable without disableSourceOfProjectReferenceRedirect": true in tsconfig.json. I've realized that it's partly because we load all procedures from all routers into memory on every autocomplete access in the TypeScript language server. How can we split up the routers? I read on GitHub that maybe they should be separate packages, but how would that even work? We specifically need to be able to infer the types of specific routers so that our TypeScript language server doesn't slow to a halt. This seems basically impossible with this current tRPC API where everything must be bundled into a single MergeRouter type. We've tried splitting things up (like for instance, a v1Router and a v2Router) so that the entire router is not enumerated but then the issue becomes namespacing, because we want v1 and v2 to be under their own routers:
router({
v1: v1Router
v2: v2Router
})
router({
v1: v1Router
v2: v2Router
})
or
mergeRouters([v1Router, v2Router])
mergeRouters([v1Router, v2Router])
We really need a way to do this. tRPC is borderline unusable for us when everything is in one router. Can anyone help here?
5 replies
PPrisma
Created by spaghet on 7/24/2024 in #help-and-questions
Is there any way to avoid this cast?
public forProject<T extends Prisma.unified_applicationDefaultArgs>(
projectId: string,
payload?: T,
txn: Prisma.TransactionClient = this.prisma
) {
return txn.unified_application.findMany({ where: { projectId, ...payload } }) as Promise<
Array<Prisma.unified_applicationGetPayload<T>>
>
}
public forProject<T extends Prisma.unified_applicationDefaultArgs>(
projectId: string,
payload?: T,
txn: Prisma.TransactionClient = this.prisma
) {
return txn.unified_application.findMany({ where: { projectId, ...payload } }) as Promise<
Array<Prisma.unified_applicationGetPayload<T>>
>
}
I specifically want to avoid the as Promise<Array<Prisma.unified_applicationGetPayload<T>>> cast. Basically I want the caller to be able to pass in any argument they want. I'm creating the arguments by:
export const UNIFIED_APPLICATION_PAYLOAD = Prisma.validator<Prisma.unified_applicationDefaultArgs>()({
export const UNIFIED_APPLICATION_PAYLOAD = Prisma.validator<Prisma.unified_applicationDefaultArgs>()({
2 replies
TtRPC
Created by spaghet on 1/9/2024 in #❓-help
We're having some serious Intellisense performance issues with v10
Hello. We have about ~30ish routers in mergeRouters (we're working on changing this to a namespaced router) but we're having some serious performance issues (10s+ to open Intellisense in VSCode with extensions disabled). We've also confirmed that TypeScript gets slower the more routers we add. Obviously this is expected, but we didn't think we'd run into this issue with 100+ procedures. We thought we'd be facing an issue like this with 2,000+. Any help on this would be appreciated. We'd be happy to send over an NDA and pay for help as well. Although I can always talk through what's going on here on Discord and add some traces if you feel it would be useful. Btw this is in a monorepo configuration. I haven't yet tried isolating the package on its own and testing to see if the performance is any better. It's a very big project that powers our startup. Thanks.
18 replies