Is there anyway to obtain the `user` property in t...
# prisma-whats-new
m
Is there anyway to obtain the
user
property in the first component as part of a filter variable? This throws an error (
user
comes up as undefined):
Copy code
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:
Copy code
export default graphql(userQuery, { options: { fetchPolicy: 'cache-and-network' } })(Main)
Child component:
Copy code
export default graphql(getContacts, {
	options: ({ user }) => ({
		variables: { contactFilter: { contactToUser: { id: user.id } } },
		fetchPolicy: 'cache-and-network'
	})
})(ChildComponent)
FYI, I simply broke it up into two components, not a big issue… one being called after the other.