apollo-feature-requests
apollo-feature-requests copied to clipboard
Subscription component - onComplete and onError
This request is quite simple, I'd like the same onComplete and onError props that Mutation and now Query have. The use case is to allow manipulation of props within a handler. For instance, when using recompose withState, a setter cannot be run within render without violating anti-pattern guidelines. But within onComplete and onError this is possible due to the nature of handlers not being able to trigger infinite loops.
e.g.
onError(error => { setNotification({type: 'error', message: error.message}) })
Currently I am converting all subscriptions to use Query w/ subscribeToMore and avoiding the Subscription component because of the lack of these handlers.