Re:GQless: A GraphQL client built for rapid iteration
by occz on Wednesday June 02, 2021 @10:49AM
(#27369328)
Handling loading states also seems to be a little bit on the anemic side, but I didn't investigate too deeply.
Re:GQless: A GraphQL client built for rapid iteration
by merrywhether on Wednesday June 02, 2021 @02:30PM
(#27372243)
The primary example code relies on Suspense, meaning that loading behavior will be handled by a parent/ancestor <Suspense /> component and not in the component itself. I think they default to showing this pattern since it is the “future” of React. There is an alternate version of the API where you can get a loading boolean for imperative control.
Re:GQless: A GraphQL client built for rapid iteration
by a_humean on Wednesday June 02, 2021 @11:31AM
(#27369851)
Yes, it doesn't really distinguish between loading vs null values in any of the examples.
My guess is its going to be something like `undefined` means loading and `null` means null.
Re:GQless: A GraphQL client built for rapid iteration
by nwienert on Wednesday June 02, 2021 @01:24PM
(#27371438)
There’s a different hook you can use that returns an error state.
Re:GQless: A GraphQL client built for rapid iteration
by merrywhether on Wednesday June 02, 2021 @02:35PM
(#27372297)
The useQuery hook’s opts have an onError property that accepts a callback.
I also don’t see anything about union types. That definitely seems like the hardest thing to reverse construct based on usage, since the underlying proxy wouldn’t know what you’re doing with __typename.
How do you deal with union types? The docs seem completely scant on that.
Otherwise very interesting approach.