So does this mean we should make a distinction between returning a cursor and a record for Blaze template consumption?
return cursor from helper:
return personsCursor: function () {
var personsCursor = client.query('
persons {
field1
field2
}
')
return personsCursor;
},
return just a field from helper:
return personFullName: function () {
var record = client.query(`
persons { fullName }
`)
return record;
},
And where is reactivity handled, within Apollo? So in the future, where would we turn off and on reactivity? For example, would we pass a isReactive on a field by field basis or something else?
Sounds good! Letās start with a repo and some āquick startā docs to get me up to speed.
Unfortunately Iāve been too busy to fiddle with any of GraphQL and React/Angular beyond a few quick hacks out of curiosity, but Iām gonna dive into docs now so we can discuss it further.
We just rewrote it from scratch so it should be pretty complete.
There is no concept of returning a ācursorā or āfieldā from GraphQL.
Apollo Client has two methods: query and watchQuery. The first is a one-time fetch and the second is reactive. Thereās no per-field reactivity right now and probably wonāt be in the near future.
I disagree - Thereās no way Apollo will look like Minimongo, because itās completely different. We need to find something thatās a natural way to use GraphQL together with Blaze, itās going to necessarily be different from what we had before.
So without a Apollo + Blaze abstraction, any query using straight Apollo client inside the helper would be a straight Rest API call out to the Apollo client, and it will return a raw Json object?
It would be natural to have the queries inside the helpers I think. The Apollo + Blaze client we are discussing will abstract out the calls to the Apollo client correct, and this will be all its doing (it wonāt be modifying Blaze itself)? And there will be no reactivity in the Apollo client, so thereās no way this abstraction will have reactivity. Therefore all these queries will one once on Temple render?
Apollo client is reactive. We just need a really thin bridge to convert an observable into a Tracker-reactive function, which should be about 3 lines of code.
Anyway, letās see what @miro comes up with, then we can talk in much more concrete terms.
Agreed! Iām excited to see what comes out of this.
As an aside, if people here are looking for well-constructed patterns that maintain the Blaze split of data/view, check out this post. No helpers, access to template-scoped functions and data, and an overall (in my opinion) cleaner implementation of some of the main pieces of blaze. Since adopting this pattern, itās hard to look back.
Also ā Seeing posts like this, incorporating incremental dom, etc. is amazing to see, especially in light of how many times I recall seeing that āblaze is dyingāā¦
Please make sure you have an in-depth understanding of GraphQL, Blaze, and Tracker, and intend to use this integration if itās built, before proposing designs.
@miro if/when you have something to look at, can you share a repo? Honestly I havenāt had a chance to look much at Apollo yet but I would love to see early thoughts about how it could integrate with blaze