-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type inference in executeQuery/etc #91
Comments
Yep I think you're right on @Schmavery. I think we'll need to implement the same pattern of passing the full |
If I have a chance this weekend I could try to get something out. Another thing I was wondering about is why the constructing the request and executing the query happen separately. Do you know if this request is expensive to create or something (I guess I can look into it when I get a chance). Right now in my local project, I wrote a little wrapper as a workaround that does this: module Graphql = {
let executeQuery = gqlReq => {
let req =
ReasonUrql.Request.createRequest(
~query=gqlReq##query,
~variables=gqlReq##variables,
(),
);
let parse = processResponse(gqlReq##parse);
ReasonUrql.Client.executeQuery(~client, ~query=req, ())
|> Wonka.map((. a) => parse(a));
};
// Gets called like this:
module MyQuery = [%graphql {| ... |}];
Graphql.executeQuery(MyQuery.make()) |> Wonka.forEach((. a) => Js.log(a)); Is there a reason I should be avoiding doing something like that? If we don't do it this way, we'd have to do something like having the |
Yeah I think the only reason I originally architected it that way was to match the I think what you have is totally legit. I'd like to wrap it up nicely for consumers so that they get a fully type safe response, which means I'd expect them to just pass the |
Published in 1.0.0-beta.3. |
I was just looking at making some graphql queries from a non-react (nodejs) project and realized that it seems like the type of the response from
Client.executeQuery
is aWonka.Types.sourceT('a)
, so it seems like it exhibits the same issues as #80 and #67. Same withexecuteMutation
andexecuteSubscription
.Does that sound right? I might be misreading how to use it.
The text was updated successfully, but these errors were encountered: