Splitting query into multiple observables #1700
Unanswered
daramasala
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We are converting our application to graphql and Apollo.
I noticed a pattern starting to emerge in our code and I wanted to hear what other people think.
Seems like a lot of times we make a query and then split the payload into multiple observables to pass as input parameters into presentational components.
The way we do it now feels awkward to me.
Let's say we have a query that returns a payload of the form
{name: string; color: string; }
and we would like to split it into 2 observables to pass into child components. Then we usually do this:I was thinking of changing it into:
But will it work as I expect it?
share()
or something similar on the query in order to prevent multiple queries or does Apollo takes care of this?Beta Was this translation helpful? Give feedback.
All reactions