martin
05/31/2017, 11:57 PMuser property in the first component as part of a filter variable?
This throws an error (user comes up as undefined):
export default graphql(userQuery, { options: { fetchPolicy: 'cache-and-network' } })(
graphql(getContacts, {
options: ({ user }) => ({
variables: { contactFilter: { contactToUser: { id: user.id } } },
fetchPolicy: 'cache-and-network'
})
})(Main)
)
But when I put the getContacts query on its own in another react component that’s called from that above react component, it works. Like this:
Parent component:
export default graphql(userQuery, { options: { fetchPolicy: 'cache-and-network' } })(Main)
Child component:
export default graphql(getContacts, {
options: ({ user }) => ({
variables: { contactFilter: { contactToUser: { id: user.id } } },
fetchPolicy: 'cache-and-network'
})
})(ChildComponent)martin
06/01/2017, 12:38 AM