5 ms·
I <3 this comment. How I _wish_ I could nope the hell out of our GraphQL dependency, for the reasons listed and for the frighteningly complex client libs we ha
by pandeiro 8y ago
I <3 this comment.
How I _wish_ I could nope the hell out of our GraphQL dependency, for the reasons listed and for the frighteningly complex client libs we have to use to consume it, rather than straight up ajax/fetch.
- smt88 8y agoHow does the complexity bite you? Large files, bad error messages, bugs? Something else?
- pandeiro 8y agoLimited error handling mechanism in Apollo and our backend GraphQL library means I can't use then/catch to reliably handle both network and server errors. Apollo also hijacks state management and somehow decides when to fetch over the network or render a cached response, with no particular logic I can deduce or find documentation for. Then there's the thousand lines of repetitive query code that is a joy to read/write/manage.
- jupp0r 8y agoSounds like the problem is with your client/server library choices and not with GraphQL as a concept. Your original comment implied the latter.
- smt88 8y agoI think we handle our GraphQL like we do our SQL -- handle the repetitive queries as templates. I'm curious now and will dig into the repo tonight. The state management is a problem by default. We wrote our own cache driver to fix it, which is pretty well documented thankfully. "Un-magic it" is a phrase we use a lot.
- ericcoleman 8y agoYou don't have to use anything other than `fetch` to consume a graphql API.
- pandeiro 8y agoRight, then you basically lose caching, since the everything's-a-POST requests would go to the wire every time. Not that I haven't considered making that trade-off.
- invisible 8y agoYou can use GET if you want (since GraphQL is still just over HTTP). The implementation can largely be up to you (like REST) if you want, but you get loads of things already if you opt into some opinions that libraries have established (e.g. Apollo). See https://graphql.org/learn/serving-over-http/ https://graphql.org/learn/serving-over-http/
- yencabulator 8y agoYou can make your queries ride over GET very easily, using just fetch.
- nailer 8y agoYou shouldn't be using fetch directly accoriding to it's creator anyway - use a high level HTTP client which handles MIME types, query string encoding, etc.