You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
I have a case where the server schema requires a parameter as an object with multiple properties.
When passing dynamic parameters to the query, do we always HAVE to define the query parameters and types? I am talking about the first line within GET_DOG_PHOTO (see below). Since that's already done on the server side (and it will tell us if we get it wrong), I would rather not bother with doing it again on the client side.
If there's a way around that, then we can skip the next question Splitting into Redux/React packages #2.
I'm guessing the answer to Intial build #1 is "yes, you have to". In that case, not all of my parameters are simple String & Int types. Sometimes I have objects with nested properties (see example below of what I attempted). And again, they have already been detailed out in the server schema. I have no problem passing them in via an Axios post. But I'm trying to learn Apollo and I think I'm missing something big.
Obviously I could break out the properties as individual/flat parameters, then rebuild the object in the query call.. but that would be super ugly.
Never mind. I somewhat figured it out.
The object type name (i.e. "OtherCriteria") just needs to match what's mapped on the server. I didn't occur to me to try that at first. Since that type does not exist on the client, I just assumed it would fail.
So I think I've just about got everything working. Although, I'm still not sure why I have to re-map the query signature on the client side. It seems like I'm just ending up with a lot of redundancy. But maybe it'll make more sense as I get deeper into it.
Never mind. I somewhat figured it out.
The object type name (i.e. "OtherCriteria") just needs to match what's mapped on the server. I didn't occur to me to try that at first. Since that type does not exist on the client, I just assumed it would fail.
So I think I've just about got everything working. Although, I'm still not sure why I have to re-map the query signature on the client side. It seems like I'm just ending up with a lot of redundancy. But maybe it'll make more sense as I get deeper into it.
I have a case where the server schema requires a parameter as an object with multiple properties.
When passing dynamic parameters to the query, do we always HAVE to define the query parameters and types? I am talking about the first line within GET_DOG_PHOTO (see below). Since that's already done on the server side (and it will tell us if we get it wrong), I would rather not bother with doing it again on the client side.
If there's a way around that, then we can skip the next question Splitting into Redux/React packages #2.
I'm guessing the answer to Intial build #1 is "yes, you have to". In that case, not all of my parameters are simple String & Int types. Sometimes I have objects with nested properties (see example below of what I attempted). And again, they have already been detailed out in the server schema. I have no problem passing them in via an Axios post. But I'm trying to learn Apollo and I think I'm missing something big.
Obviously I could break out the properties as individual/flat parameters, then rebuild the object in the query call.. but that would be super ugly.
Thoughts?
Thanks
apollo-boost@0.1.23
react-apollo@2.3.3
Based on the example found here... https://www.apollographql.com/docs/react/essentials/queries.html
The text was updated successfully, but these errors were encountered: