Query vs data loader?
What is the difference between using "use server" data loader vs just using solid query based trpc for loading data?
8 Replies
Afaik both get resolved in ssr, so I don't quite understand the difference
Ignoring everthing else; what is the difference in bundle size?
I guess just the size of solid query + trpc
Which is what? 3-4x Preact? I see the primitives in SolidStart as the parts you will need.
Now if any additional benefits that you need are offered by Query/tRPC you have to consider the trade-offs. But I also think that with tRPC there is also more work maintaining the server/client interface which is basically done for you with "use server"/seroval.
- solid query allows for more complex caching (mainly more long-lived caching) than
cache
- trpc gives you procedure middleware, input validation, and their plugin ecosystem built in
- cache
+ server functions give you single flight mutations
- solid query and server functions can be combined if you want
- you can use server functions as a transport for trpc if you want (we use it for easy stream batching)
generally i'd say cache
+ server functions is the more barebones setup that requires less setup to get working, but will also need more manual work to add extra functionality.
trpc and solid query give you a lot out of the box that can be useful for making more data-heavy apps.Thanks
u know what im gonna add that to my list of solid start things i have in obsidian for whenever people ask lol
Yeah I think I will take your post for my solid start project post mortem blog.