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
Hello! I'm trying to enable strict resolvers types as described in this blog post, but I'm required to return an object with all of the non-nullable fields resolved. Many of my field resolvers are expensive (they go off to another API or data source) and so I want to lazily resolve those fields only if requested, leaning on Dataloader to reduce the amount of work needed.
From my Query.foos resolver I'd like to be able to return some Foo instances that only have an id and not someExpensiveField, and have the Foo.someExpensiveField do the work only if necessary, but the generated types won't allow a partial Foo to be returned.
Is there a nice way to do this without making all fields optional (which wouldn't make sense for my schema)?
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
-
Hello! I'm trying to enable strict resolvers types as described in this blog post, but I'm required to return an object with all of the non-nullable fields resolved. Many of my field resolvers are expensive (they go off to another API or data source) and so I want to lazily resolve those fields only if requested, leaning on Dataloader to reduce the amount of work needed.
In other words:
From my
Query.foos
resolver I'd like to be able to return someFoo
instances that only have anid
and notsomeExpensiveField
, and have theFoo.someExpensiveField
do the work only if necessary, but the generated types won't allow a partialFoo
to be returned.Is there a nice way to do this without making all fields optional (which wouldn't make sense for my schema)?
Beta Was this translation helpful? Give feedback.
All reactions