You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the resolver for the Database type, I retrieve the connection for the database with that specific id. In the resolver of the Table and Column types, I need that connection object or a reference to it. How can I share the state created in the resolver for Database with the resolver for Columns. I know one could use the info parameter in the resolvers but given its lack of documentation, it feels like a hacky and prone to change/break in the future.
I thought about simply adding the state to the result object of the Database resolver and pass it along all the way down Column's resolvers but that kind of feels dirty.
Is there a way to add something to the context object from within a resolver?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an example schema that looks like this:
In the resolver for the
Database
type, I retrieve the connection for the database with that specificid
. In the resolver of theTable
andColumn
types, I need that connection object or a reference to it. How can I share the state created in the resolver forDatabase
with the resolver forColumns
. I know one could use theinfo
parameter in the resolvers but given its lack of documentation, it feels like a hacky and prone to change/break in the future.I thought about simply adding the state to the result object of the
Database
resolver and pass it along all the way downColumn
's resolvers but that kind of feels dirty.Is there a way to add something to the
context
object from within a resolver?Beta Was this translation helpful? Give feedback.
All reactions