nytimes / react-tracking

🎯 Declarative tracking for React apps.
https://open.nytimes.com/introducing-react-tracking-declarative-tracking-for-react-apps-2c76706bb79a
Other
1.88k stars 123 forks source link

Return rejected promises #106

Closed Sicria closed 4 years ago

Sicria commented 5 years ago

After updating from 5.3.0 > 5.6.0 the decorator now does not return the value of a promise.

@track(props => ({
  action: 'FormSubmit',
  label: props.name || null,
}))
handleSubmit = values => this.props.onSubmit(values).then(() => {}, err => err);

The onSubmit function above returns a promise which returns an error to display submission errors via react-final-form. If the decorator is used this error does not get reported as the value isn't passed through.

tizmagik commented 5 years ago

Thanks for submitting an issue. My guess is this behavior changed in v5.4.0.

For your use case I'm not sure I understand what is the desired behavior and whether the new async/promise support mentioned in the docs would help your particular use case?

tizmagik commented 4 years ago

Fixed in #147 and released as v7.3.0 -- thanks for reporting! 🎉