I am currently developing a backend application that collects data from GraphQL endpoints using ApolloClient
:
const client = new ApolloClient({
uri: uri,
link: new HttpLink({ uri: uri, fetch }),
cache: new InMemoryCache({
addTypename: false,
}),
});
When I utilize the query
function:
client.query({
query: query,
variables: vars,
fetchPolicy: "no-cache",
})
An ApolloQueryResult
object is returned:
ApolloQueryResult<T> = {
data: T;
errors?: ReadonlyArray<GraphQLError>;
error?: ApolloError;
loading: boolean;
networkStatus: NetworkStatus;
partial?: boolean;
}
I'm having difficulty understanding how to manage the loading
and partial
states as the documentation does not provide clear instructions. Since I am not utilizing React, I am uncertain if these states are relevant only for frontend operations.
Through testing, I have noticed that both partial
and loading
always remain undefined
regardless of the endpoint being called. Is there a correct way to handle these states within a node environment? Could it be possible for them to not be undefined
?