Generate types for loadingState
exposed for deferred queries
#539
Labels
🎉 feature
New addition or enhancement to existing solutions
With
@defer
support coming to Apollo Client, a new fieldloadingState
is exposed onApolloCurrentResult
, so that users are able to use it to distinguish betweennull
andpending
states for any field. Reference: apollographql/apollo-client#3686loadingState
mirrors the shape of the data that is returned from the query. For example, for a query below:The data returned as part of the initial response looks like this:
And the
loadingState
looks like this:After all patches resolve, the leaf nodes of
loadingState
would all be set totrue
.Therefore, the type associated with
loadingState
has the same structure asdata
, except that its leaf nodes are typed asundefined | boolean
rather thanGraphQLOutputType
. It will be really nice to have codegen support for this so that users can get autocomplete on theloadingState
too.The text was updated successfully, but these errors were encountered: