Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

manual query requires gpl function #169

Open
1 task done
Enalmada opened this issue Dec 12, 2018 · 0 comments
Open
1 task done

manual query requires gpl function #169

Enalmada opened this issue Dec 12, 2018 · 0 comments

Comments

@Enalmada
Copy link
Contributor

I am preloading apollo cache data on hover of link. onMouseEnter={_event => apolloClient##query(...)}
The "query" variable requires wrapping in gpl explicitly:

[@bs.module] external gql: ReasonApolloTypes.gql = "graphql-tag";
apolloClient##query({
  "query": gql(. getDiscussionsQuery(page, filter)##query),
  "variables": getDiscussionsQuery(page, filter)##variables,
})

or I get an error like this:

 Found uncurried application [@bs] with arity 1, where arity 1 was expected.
  This has type:
    ApolloClient.generatedApolloClient (defined as
      {. "mutate": (ApolloClient.mutationObj =>
                    Js.Promise.t(ReasonApolloMutation.renderPropObjJS))
                   [@bs.meth],
        "query": (ApolloClient.queryObj =>
                  Js.Promise.t(ReasonApolloQuery.renderPropObjJS))
                 [@bs.meth],
        "resetStore": (unit => unit) [@bs.meth]})
  But somewhere wanted:
    {.. "query": ({. "query": string, "variables": Js.Json.t} => 'a)
                 [@bs.meth]}

Should reason-apollo be doing the gpl wrapping "query": gql(. getQuery##query) internally or is this the desired behavior?

Issue Labels

  • feature
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant