Comments (4)
this is the related issue on graphql_ppx repo: mhallin/graphql_ppx#9
By the time it is fixed, you could also use an alias, which works fine
module GetUser = [%graphql
{|
query getUser ($pk: ID!){
user: User(id: $pk){
username
}
}
|}
];
from reason-apollo.
It is exactly what the error is saying
you are trying to access _User
in response
with response##_User
but what actually exists is response##User
.
Also, field names should be camelCase and not PascalCase in GraphQL, I think you'll have a problem there by using User
, so update your server schema so you can do this instead for querying:
query getUser ($pk: ID!){
user(id: $pk){
username
}
}
from reason-apollo.
response##User does not work:
https://bucklescript.github.io/docs/en/object.html#name-mangling
response##_User should be legal.
Though I did give response##User a try and got:
70 ┆ | Loading => <div>(str("Loading"))</div>
71 ┆ | Error(error) => (Js.log(error));<div></div>
72 ┆ | Data(response) => (Js.log(response##User##username));<div></div>
73 ┆
74 ┆ }
Js object ## expect syntax like obj##(paint (a,b))
ninja: error: rebuilding 'build.ninja': subcommand failed
>>>> Finish compiling(exit: 1)
Using lowercase for the schema wouldn't be possible in the short term.
from reason-apollo.
Thans @grsabreu.
For posterity, the work around is to use raw:
switch result {
| NoData => <div>(str("No Data"))</div>
| Loading => <div>(str("Loading"))</div>
| Error(error) => (Js.log(error));<div></div>
| Data(response) => {
<div>({let rawUser = [%raw{|result|}];
let user = rawUser[0]##_User;
let username = (user[0]##username);
username
}
from reason-apollo.
Related Issues (20)
- Spike on cypress watch mode
- Support react-apollo >=3 ? HOT 2
- WriteQuery with enums seems unusable HOT 4
- Fragments doesn't work in 0.17.0 HOT 2
- Forward Guidance: Reason Apollo Continued Development? HOT 7
- Upgrading to [email protected] errors HOT 3
- Updating the example
- [email protected] HOT 2
- graphql_ppx/ppx not found when resolving ppx-flags HOT 3
- Version compatibility issue with ReasonApolloMutation.re ? HOT 6
- PPX issue due to bs-platform HOT 3
- Missing git tags for 0.19.0 and 0.20.0 releases
- How can setContext be used? HOT 7
- Mutation promises rejected instead of resolving with Errors
- Can't call `mutate` on the `client` when using `Consumer` HOT 2
- Upgrading reasonreact to v0.8.0 breaks
- How to use awaitRefetchQueries?
- Not working with bs-platform 8 (jsx 2 in example)
- Compilation error when try to use generatedApolloClient.query
- Unable to set timeout to WebSocket configuration options
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reason-apollo.