jeddeloh / rescript-apollo-client

ReScript bindings for the Apollo Client ecosystem
MIT License
127 stars 18 forks source link

Fetching fragment along with other fields #139

Closed Arnarkari93 closed 2 years ago

Arnarkari93 commented 2 years ago

I'm facing an issue when trying to fetch a fragment alongside other fields of the same type. In the graphql-pxx docs there is this example:

query UserQuery {
    user {
      id
      role
      ...Avatar_User
    }
}

When I try to create a similar query I get an error saying that the GraphQL_PPX module is not found. I tried to add a open ApolloClient in the same module as I define the query and then I get a different error, saying the the deepMerge method is not defined under GraphQL_PPX.

Versions:

"@apollo/client": "^3.5.7", 
"@reasonml-community/graphql-ppx": "1.2.2",
"graphql": "^16.2.0",
"rescript-apollo-client": "2.4.1",

Reproduce example: https://github.com/Arnarkari93/fragment-reproduce-issue

jfrolich commented 2 years ago

You need to include @reasonml-community/graphql-ppx in bs-dependencies of bsconfig.json. When you mix fragments with fields we need some runtime code in the serialize function.

Arnarkari93 commented 2 years ago

🤦‍♂️ I feel so stupid, thank you again!