is there a definitive solution to the slow language server/compilation issue?
it takes 5-20 seconds to load suggestions in many files in our project.
6 Replies
I don't know if it'll work for you @tltl , nor am I sure how long it'll work/be supported for. But I gave https://github.com/algora-io/xtrpc a shot yesterday as yeah, I was running into quite significant language server issues. This helped massively.
There were some discussions here, which I think the TLDR of it was to split up your router definitions https://github.com/trpc/trpc/discussions/2448
GitHub
GitHub - algora-io/xtrpc: Export your tRPC router to massively impr...
Export your tRPC router to massively improve language server performance and/or let your users consume your API from a typed SDK - algora-io/xtrpc
GitHub
Resources for improving typescript performance? · trpc trpc · Discu...
Our project is at about 40 end points using tRPC V9 with react and we're experiencing a pretty substantial slowdown of typescript. Mutations in particular are excruciatingly slow at this point....
Not exactly a very scientific testing method, however generating ~1000 endpoints with zod schemas etc.. i mean it's practically night and day.
Hi @tltl a lot of people experiencing these types of issues.
Some useful comments from Alex here: https://discord.com/channels/867764511159091230/1020132255567454310/threads/1260588869967937556
I run into many errors trying to use xtrpc
I also see this caveat in the readme
𝕏tRPC may not work properly if your procedure outputs are not explicitly declared. For best results, add .output to all of your procedures (which is a good practice to not leak sensitive info anyways) and enable explicitOutputs in your xtrpc.config.jsonNot sure if that's related, but we have zero use of
.output
in the codebase@tltl not using .output on our end either. As Gabriel said some good comments from Alex about what you could try alternatively there. But someone mentioned on the GH about a similar had issue https://github.com/algora-io/xtrpc/issues/3 so perhaps you might need to change some things in your tsconfig?
Maybe also try and narrow down your AppRouter to begin with if you want to go down this direction further
GitHub
Error: A sibling of kind 357 was expected. · Issue #3 · algora-io/x...
Hi, I tried to use the tool in hope of improving the type completion. However, when I run it on our project I get the following error and I don't know how to really debug it. Error: A sibling o...
is there a solution where each individual trpc mutation/query is it's own router? and then I just import and use the appropriate "router" when needed. would that help?
I have no need for any of the query invalidation, caching, or nesting "paths", I'm basically just looking to import and run functions on the frontend.