builder.args
vs Reusable Args Pattern from Docs
#1178
Unanswered
arimgibson
asked this question in
Q&A
Replies: 1 comment
-
I think using builder.args is probably in general better. The one caveat I'd add is that the current version of Pothos was not intended to re-use args. I'm not sure if you'll run into any issues if you re-use the same arg refs on multiple fields. It's probably safer to do something like: export const createConversationFilterArgs = () => builder.args((t) => ({
conversation_medium: t.field({
type: ConversationMedium, // this is an enum pulled from Prisma schema
}),
status: t.field({
type: ConversationStatus,
}),
})); Pothos v4 refactors a lot of things so that it will be safer to re-use refs, or combine refs created by separate builders |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there! Working on DRY-ing some argument declarations for a large project using Prisma, Pothos, and Relay.
As far as I can tell; there is no difference in return types from these two methods... one uses
builder.args
and one uses this more complex pattern from the docs.builder.args
Args pattern from docs
Return types
Is there any reason anyone would want to use the more complex pattern that the docs currently recommend? If not, are the docs out of date? Would be happy to PR an updated example and text. Thanks as always!
Beta Was this translation helpful? Give feedback.
All reactions