react-apollo-hooks icon indicating copy to clipboard operation
react-apollo-hooks copied to clipboard

Fix fallback of `data` attribute in query result

Open sgoll opened this issue 5 years ago • 1 comments

Related to #127.

As described in https://www.apollographql.com/docs/react/essentials/queries#props, the data object is either the actual query result, or the empty object {} when the data is not (yet) available.

The type of QueryHookResult should match that.

sgoll avatar Apr 29 '19 17:04 sgoll

Alright, it seems it's more complicated than this. I guess we'd need a type union to differentiate between loading and/or failed queries (that have data of {}) and completed queries (that have actual data).

And then there's partial queries also …

sgoll avatar Apr 29 '19 17:04 sgoll