apollo-feature-requests icon indicating copy to clipboard operation
apollo-feature-requests copied to clipboard

Subscription component - onComplete and onError

Open alienfacepalm opened this issue 7 years ago • 0 comments

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.

alienfacepalm avatar Sep 20 '18 22:09 alienfacepalm