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
I need to add a condition on if(result.data?.user)only for typescript. If loaded is set to true, and error to false, data should be present no ?
Actually there is no discriminant in the QueryResult definition. Do you think it could be a good new feature ?
The text was updated successfully, but these errors were encountered:
There are various situations where loading might be false, no error is present and you still have no data - e.g. if you are currently skipping the query.
Unfortunately, it's not that simple and almost impossible to represent in types - it would be a big explosion of types, and you'd always have to check networkStatus, too, at least - a boolean alone will never be enough here.
That said, we will try to add some improvements in that direction in the future, but it will also get a lot better once you start using the suspenseful hooks like useSuspenseQuery instead of useQuery, as there are just no loading and error states to manage there.
Hi everyone,
In react, when I use Apollo client for a query I got a QueryResult type with loading, data, and error.
in my code I have :
I need to add a condition on
if(result.data?.user)
only for typescript. If loaded is set to true, and error to false, data should be present no ?Actually there is no discriminant in the QueryResult definition. Do you think it could be a good new feature ?
The text was updated successfully, but these errors were encountered: