This is not a super serious issue and far from a feature request, but in using react-apollo, I have found the options property provided to graphql to be extremely useful.
Typically, for many options (like variables), logic is derived from props of the wrapped component, so it makes sense for ownProps to be made available to the callback function to options. However, I found that ownContext is not made available to the callback function. While this is not a major problem, I want to avoid a wrapper of a wrapper to make context available through a roundabout way and was wondering if there is anyway the this.context of a wrapped React component can be made available to graphl(query, options), specifically:
export default graphql(gql`mutation { ... }`, {
options: (props, context) => ({
// Options are computed from `props` here.
// Context available
}),
})(MyComponent);
A few examples I have run into where this is an issue is global variables like the currentUser which would be useful to have, especially on mutation.
This is not a super serious issue and far from a feature request, but in using
react-apollo
, I have found theoptions
property provided tographql
to be extremely useful.Typically, for many options (like variables), logic is derived from
props
of the wrapped component, so it makes sense forownProps
to be made available to the callback function tooptions
. However, I found thatownContext
is not made available to the callback function. While this is not a major problem, I want to avoid a wrapper of a wrapper to makecontext
available through a roundabout way and was wondering if there is anyway thethis.context
of a wrapped React component can be made available tographl(query, options)
, specifically:A few examples I have run into where this is an issue is global variables like the
currentUser
which would be useful to have, especially on mutation.