Closed jthomaschewski closed 6 years ago
@jbbr if you need data, from 2 unrelated collections in 1 react component, good one! I would extend createQueryContainer, to allow as first argument a query or an object of queries {{x: query1, y: query2}}.
But my question is why don't you use componentDidMount, and do the fetching manually ? This looks very confusing:
createQueryContainer(query1, createQueryContainer(query2, Component, options2), options1)
Allowing multiple root points... I need to think about it. ( I added it as a issue in grapher ) The problem arises when you want to make it reactive, you would still have to subscribe to two different publications. One publication can be ready, the other may not be ready, when do we return the data, wouldn't keeping them in isolation be best.
I often need data from multiple, unrelated collections in a react component. I'm not quite sure how to fetch them properly.
Currently I'd have to do something like this:
createQueryContainer(query1, createQueryContainer(query2, Component, options2), options1)
Possible solutions:
grapher-react: Allow something like
createQueryContainer([query1, query2], Component, [options1, options2])
(I don't really like the fact that this would require 2 arrays for options. I'm sure there are nicer ways to solve this)grapher Allow multiple "main root points". E.g:
This would be really nice for me.
I'm quite new to grapher and GraphQL-style queries in general. So maybe I'm trying to work against the concept and these queries shouldn't be required?