Skip to content

Create Batch Resolvers #1287

Answered by KATT
ecwyne asked this question in Q&A
Nov 18, 2021 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

I usually use the dataloader-package - in tRPC I have my own implementation on the client as it has some specific needs (which isn't exposed as it's just intended for internal use).

You'd create a data loader in your createContext-method for each request and access it in the resolver through the ctx-property.

Note, if you use Prisma, you don't have to implement a data loader at all as it's built-in.

Exactly how you type your flavour of data loader is not something I can spend time helping you with, as it's not specific to tRPC.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@luixo
Comment options

Comment options

You must be logged in to vote
2 replies
@ecwyne
Comment options

@KATT
Comment options

Answer selected by ecwyne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1284 on November 18, 2021 14:18.