loading...

re: What are the cons of GraphQL? VIEW POST

FULL DISCUSSION
 

Besides the mentioned drawbacks one that I see is that instead of relying purely on JSON they invented a custom DSL (wrapped inside a JSON), which comes with a custom parser that adds a substantial amount of JS to your code. In our case we we went from a ~380k bundle to a 600k bundle (before gzip).

 

Why do you have a graphql parser on your frontend?

 

Practically all clients (e.g., Apollo, urql) come with a query evaluation which requires a parser. This is not the schema parser, but it's still part of the graphql standard lib.

So if your client relies on the graphql package you have a parser in there, too.

I just took a look and neither urql, Apollo-client, react-Apollo, nor their dependencies have the graphql package as a dependency.

Unless I just missed it, you shouldn’t have a graphql parser client side

Sorry either you don't know these libs or you just like trash talk.

  1. Apollo ships with it's own implementation. It still parses the queries (it needs to for several reasons).
  2. urql has a peer dep to graphql. See github.com/FormidableLabs/urql/blo....

Still a parser is needed as all these libs perform validation up front and provide additional capabilities such as caching. They could all be added without additional parsing, but then it would be more cumbersome for the dev thus making the abstraction useless.

Jeezus man chill out. I just checked their deps on npmjs.org.

Didn’t know to check peer deps.
Nor did I know that apollo shipped their own.

You can do without. The Clojurescript client just sends a string over the wire, and get a Clojure map back.

That’s what I was thinking, but, I guess, Apollo needs some info on the query for it’s caching solution.

That makes sense. The Clojurescript library is more low level. It might be nice to have something similar to Apollo. But I quite like the simplicity of just binding the results of a query to some data in de dB. It's also easy to combine queries and subscriptions that way.

The big draw to Apollo for me is honestly not so much the caching, alththats a big plus, but the fact that GraphQL-codegen can make fully typed Apollo hooks for each GraphQL query or mutation I write.

It’s magical.

Clojurescript isn't typed so that won't work :P. Although you could build something similar using spec. You could even use generative testing out of the box that way for components created that way.

 
code of conduct - report abuse