Closed lucas-teks closed 4 years ago
Awesome, thanks for finding this! I want to dig into this a little further and see exactly where issue is. Did I improperly type network status and it is supposed to be option(int)
? Or did I improperly type something else and that type should have option(NetworkStatus.t)
? Or is there no issue on our end and it's a bug in Apollo? I'll see if I can look into it later tonight.
So it looks like it's indeed a bug (or bad type) in apollo client. So the question becomes, do we default to Ready
like you have above, come up with a new variant like SkippedOrNotPresent
, or just switch NetworkStatus.t
to be optional everywhere? I lean toward one of the first two, but will sleep on it and see if we get any input in the meantime.
And of those two, I'm kinda leaning toward SkippedOrNotPresent
because it's the only one that actually conveys what's happening and doesn't require you to unwrap unnecessary optionals
Hello,
I just encountered a runtime error with the graphql-ppx
use
hook, it appears that in a certain case when the~skip
argument is passed astrue
the NetworkStatus gets undefined.Here's how I fixed it, I suggest these changes:
let toJs: t => Js_.t = tToJs;
let toJs: t => Js_.t = (t: t) => Some(tToJs(t));
let fromJs: Js_.t => t = string => tFromJs(string)->Belt.Option.getExn;
let fromJs: Js_.t => t =
optionalString => {
switch (optionalString) {
| Some(string) => tFromJs(string)->Belt.Option.getExn
| None => Ready
};
}; };
Thanks for the great contribution!